Summary: I took over managing a TailwindCSS website and don't have the tailwind.config.js file.
Problem: How do I rebuild the TailwindCSS for my site, without the tailwind.config.js file used to create it?
Question: is there a way to reverse generate/create the tailwind.config.js file used to generate the TailwindCSS used on my website?
Detail: I just joined a company where the person I replaced (who left the company), built our corporate website using TailwindCSS. The problem is, I can't find the config file used to build the Tailwind CSS bundle - preventing me from creating new html pages. How can I "reverse generate" from the existing CSS I have to recreate the build config.js file used for Tailwind?
What have I tried: I have tried loading up a single page of our corporate site at https://play.tailwindcss.com/ and iterating (manually) on what the config.js file might have included that generated our corporate website; however, the output is radically off.
As such, is there a technical way to "reverse generate" what the tailwind.config.js was that resulted in the CSS that generated my site?
I would start by setting up a sandbox to experiment with site rebuilding. Try building existing content with default Tailwind config, then compare the output with your live site. Using diff -ur should help you identify specific features that need to be configured. Adjust these config options and build again until the list of differences between your sandbox and the live site are minimal (date stamps or similar).
You might also try doing a grep -r for any config options you know would have been used. Keep in mind that the config file does not have to be called tailwind.config.js (see the docs for more). You might get lucky and find that the config was just named something unexpected.
Related
I have, in some unexplained way, managed to get my first Jekyll site with the "Agency" theme running locally.
However, there is something that is still not right. I extracted all the files from the biggest zip file of the theme, which seem to cover all files.
First I must point out that I'm not using GitHub at all for my site. Using only local resources on my Windows machine (afaik), and I'm developing by browsing http://localhost:4000.
I get this warning:
Jekyll Feed: Generating feed for posts
Conflict: The following destination is shared by multiple files.
The written file may end up with unexpected contents.
C:/web/_site/assets/css/agency.css
- assets/css/agency.scss
- C:/web/assets/css/agency.css
...done in 0.1660095 seconds.
This creates strange behaviour. I run these commands:
bundle update
bundle exec jekyll serve
... The site works perfectly until I make some changes that make the style of the page go bananas. I assume it has to do with the warning of the CSS file. It's like it reverts back to some default CSS and my latest changes won't show.
When running the serve command everything auto-updates anyway. The CSS warning conflict never goes away though.
In my _confg.yml file, I could run any of these lines (or comment them both out) and it will work:
theme: raviriley/agency-jekyll-theme
remote_theme: raviriley/agency-jekyll-theme
I'm still confused in general about how Jekyll works and what might have happened in my case. Hope someone can help me solve the conflict thing.
Not sure what you have changed in your CSS but I cannot reproduce your issues using the Agency theme locally on Windows (I have downloaded the theme here and copied all files).
By default, the _config.yml file contains this line for the theme: theme: jekyll-agency. After running bundle and starting the jekyll server, I can see the page. Any modification, such as * { color: red } shows fine, I don't get errors in the logs.
One difference to your version
There is no agency.css file but only the SCSS version of it. The SCSS file is localed in assets\css\agency.scss
This file imports all the other variables and styles. The styles are placed in scss files in these three folders:
base
components
variables
Of course, you can also add styles to the agency.scss file but I would not do it, the component/layout structure makes sense. Read about the Sass Basics here: https://sass-lang.com/guide
I'm developing a Wordpress "widget" that is going to be a little react app. I've chosen create-react-app for this purpose.
Now I can see how to run the development server standalone easily enough, but I'd like to develop it while it sits inside the Wordpress website. I've created a trivial "Custom HTML" widget:
<div id="root"></div>
<script type="text/javascript" src="http://localhost:8080/static/js/bundle.js"></script>
This does not seem to work however...
Note I came up with /static/js/bundle.js by looking at the requests in the network tab when loading http://localhost:8080 directly, which is the prescribed way to access the dev version of the app.
So how do I access the development version of the app (with all the live reloading goodness) while embedded on my local version of the Wordpress site?
I had this same problem today in a PHP app I am developing. It is very frustrating to embed a create-react-app in development mode, and I had to consult a lot of different resources to learn how to do so. Here is a summary of my findings.
Using an iframe
Using an iframe to embed the create-react-app, as #quickshiftin suggests, is not a bad idea, but if you wish to pass configuration to the embedded SPA by calling methods or setting global variables in Javascript, it will not work* -- as the MDN documentation says (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#scripting), iframes are subject to the same-origin policy.
* (Note: I found out after writing most of this answer that there is indeed a way to bypass the same-origin policy. It's called Window.postMessage(), and it's also mentioned in the section of the MDN documentation that I linked above. You may want to consider using that. But if you would like to avoid using an iframe for whatever reason, read on :)
Create-React-App file structure; embedding in production mode
The first thing you must know is that embedding bundle.js is not enough -- create-react-app builds multiple JS files that need to be embedded using <script> tags in the correct order. This blog post by Jeremiah Tabb describes the file structure of the bundled code and suggests a way to embed the create-react-app in production: https://betterprogramming.pub/how-to-embed-a-react-application-on-any-website-1bee1d15617f
The filenames of the bundled code contain hashes which change at every build. The hashing can't be disabled, it's a WONTFIX in create-react-app (https://github.com/facebook/create-react-app/issues/821). So, to get the bundled js filenames for a production build, in PHP, you can just traverse the build/static/js directory and output one <script> tag per .js file you find. (It may be wasteful to always request all chunks, but I haven't yet taken the time to look into the right way to do it.)
Development mode looks for chunks under the wrong path
But in development mode, which is your actual question, it is handled a bit differently. The index.html served by the dev server only loads three scripts initially: bundle.js, vendors~main.chunk.js and main.chunk.js. The other chunks are loaded dynamically. You can try embedding those three scripts on your Wordpress page, but you will find that at runtime, the 'bootstrap' code generated by Webpack looks for the chunks at the wrong URL, using e.g. localhost instead of localhost:3000, resulting in a chunk loading error.
PUBLIC_URL and "homepage" don't work in development mode
According to the Create-React-App documentation and various other answers on this site, you're supposed to be able to use the environment variable PUBLIC_URL or the key "homepage" in package.json to override the hostname and port where the JS code is served so that the chunks will load, but these settings don't do anything in development mode. This is an open issue in create-react-app: https://github.com/facebook/create-react-app/issues/9001
Workaround using npx patch-package
You might think you are in trouble and will have to eject your project and modify the webpack configuration yourself to get this working. But fortunately, there is a workaround described here in a comment by SergeyVolynkin which solves the problem without ejecting, using npx patch-package to patch react-dev-utils:
https://github.com/facebook/create-react-app/issues/9001#issuecomment-838370686
What SergeyVolynkin does not mention is that, after creating the patch and checking it into VCS, you should set up patch-package in your package.json so that the patches will be applied by npm / yarn when you run yarn / npm install. See the documentation for patch-package here: https://github.com/ds300/patch-package#set-up
Summary
After applying SergeyVolynkin's patch, I was able to get the development build embedded in my PHP app. I used the following scripts in my package.json:
"scripts": {
"start": "PORT=1234 PUBLIC_URL=http://localhost:1234 WDS_SOCKET_PORT=1234 react-scripts start",
"postinstall": "patch-package"
}
And I used the following lines in the HTML served by my PHP app:
<script src="http://localhost:1234/static/js/bundle.js"></script>
<script src="http://localhost:1234/static/js/vendors~main.chunk.js"></script>
<script src="http://localhost:1234/static/js/main.chunk.js"></script>
By doing this, I could embed an app created using create-react-app in dev mode in my PHP app.
I have a Django project that requires authentication, and the django.contrib.auth code has been working great so far. However, I'd like to edit the provided login page to say something like "MyProject administration" instead of "Django administration", and alter the colors in the CSS files a little bit. I'm having trouble finding where these files are located in the project.
Is there a way to edit the default files, or do I have to copy/rewrite all the functionality in my own files? I'd love to just tweak the defaults, if that's possible.
Yes! can directly modify the framework. the installation folder depends on what operating system you use and if you use virtualenv. you have to find this file in your pc and edit it: https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/login.html
if you use virtualenv can found it in this directory "virtualenv/lib/python3.6/site-packages/django/contrib/admin/templates/admin"
We have a few html pages in one of our solutions that are meant to be extremely simple, client side only, pure html+javascript pages that access our web api. The api itself is in a web application project in the same solution.
We are now using a web site project to contain those files, but it is getting harder and harder to manage that project, since it's information is placed on the solution, and most of it's aspects cannot be controlled like they can on a msbuild project file.
I'd like to migrate those html files to a web application project, but I'm struggling to make it as basic as possible. For instance, I do not want to generate any dlls on the project. It should be in the solution just to provide access to the files and to enable us to control what goes to the _PublishedWebsites folder on the build by setting the build action on the files. We need this because there are some miscellaneous files in the project that should not be published.
I tried creating an empty web application and removing most things from it, by editing the csproj file. I managed to delete all references and the whole Properties special folder (along with the AssemblyInfo.cs file), but when I run the build command, I still see a dll created along with the obj and bin folders. Then, I tried faking the build target on the csproj file, like this:
<Target Name="Build" />
Now when the project is built, no dll/pdb is created, but the obj and bin folders are still there. Next, I tried setting the outputpath property to the current directory, like this:
<OutputPath>.</OutputPath>
But even then, the obj folder is still created.
EDIT:
I just found another common msbuild property that controls where the files inside the obj folder are placed. After placing this in my csproj file:
<IntermediateOutputPath>.</IntermediateOutputPath>
I now get no folders generated on build, which is nice.
There is a small problem now though (and I'm not sure how and where exactly this process happens) when I open the solution or reload the project in Visual Studio. Even though the project is not being built at this time, some files are still generated:
I feel the current approach is enough for my requirements, yet I'd really like to know if there is a more elegant way to achieve that. Thus, the question holds: Is there a way to make the web application project work as if there was no code file in it, effectively disabling output generation (bin and obj folders, and the dll/xml/pdb outputs)?
So, I've been trying to get a web page to display links to videos (over a symbolic link) dynamically (i.e., without hardcoding an <a></a> tag for each one) I have, and I think I may have found a solution, albeit a hacky one:
Video
Ignoring that this is a horrible way to do this, does anyone know how to format the following?:
I'm guessing there is an apache config file somewhere, but it is extremely hard to search for it as I do not know what it is called when files are just listed in this manner.
i'm basically looking to resize the widths of columns, and maybe even do some pretty-fication.
this is all running on my web/file server and is being accessed form my local machine.
This is what you're looking for:
http://perishablepress.com/better-default-directory-views-with-htaccess/
This tutorial details how directory listing by Apache can be modified to suit your taste using HTAccess file.
Using Apache HeaderName and ReadmeName directives and the module "mod_autoindex.c" you can add custom markup to your directory listing pages.
For displaying links to A/V and other files, look at my website: https://wrcraig.com/ApacheDirectoryDescriptions.
It goes beyond the default directory description, providing a spreadsheet to assist in creating detailed descriptions and exporting them in FancyIndex/AddDescription format for inclusion in .htaccess.
It also provides a menu driven BASH scripted alternative, using the FancyIndex descriptive data above (automatically adding A/V durations) to recursively populate a custom index.html while retaining the security features of .htaccess.
The site has examples of the input spreadsheet and both the FancyIndex output and the optional BASH scripted output.