Created a PHP project in Sublime Text 3 that holds PHP, CSS, JS, HTML, and some other files and folders. Other files may be .md, .txt, .ico, images and fonts (.woff, .ttf, ...).
Actually project is WordPress, but the solution should be for all PHP based projects, and specifically I am interested only to check specific folders inside of project (liek theme and plugin files). WordPress core is no interest for me to check.
I would like to detect Files with extensions (.php, .css, .js) that are unused. Is there a smart solution do detect these?
For instance CSS file is not used if no other files references it. The reference may came from another CSS file or from some PHP file, or even JS file.
I am not searching for a perfect solution, but for something that is close to detect these or even for an idea how I may think about these.
In WordPress (PHP) there are require and include instructions, and also wp_enqueue_script/styles that represent the mechanism how to reference files for instance.
So we could create a list of all PHP, CSS, JS files, and then based on file names search for these in the content of all other files. This would be a good start.
Related
I have been searching all over for information on where django-cms is storing the CSS and SCSS data for my site, which I am working on localhost. When I go to edit the CSS file directly, it has no effect, so I'm wondering what needs to be done to edit those CSS files. Obviously they have been loaded somewhere. How can they be reloaded, or in general what is the best practice for editing the CSS files?
Apparently I had to do this with both the style.scss and style.css files, which seem to have the same css classes. But even after editing both files, I had to refresh the site on my localhost a few times before I could see the changes. Frustrating, but it does work to edit the files directly in the static folder.
#Lawrence DeSouza At first you should mention which plugins and style frameworks you use.
If you are using some sort of a frontend framework like Bootstrap 4 your should compile its css from scss separately. You can do it right on the dev server in a separate directory outside your project dir and cloned from the official repository. Normally you would only need to change variables in "/bootstrap-4.x.y/scss/_variables.scss" file. On the next step you would compile your *.css files with "npm run dist" command and then copy compiled files from "/bootstrap-4.x.y/dist" directory to your "/projectname/appname/static/css" directory. The process is well-documented here. After copying changed files to your "static" folder you should run "python manage.py collectstatic" and refresh the page. If it's not working after refreshing the page in a browser (normally it should work) - restart the server. I am a bit biased towards Bootstrap, but the logic should be the same in your case.
I'm importing a external web template I found in bootstrap to build a intro page. It has it's own js, css , html files.
However I found it is troublesome to transfer the beautiful external web to meteor format by hand. How you deal it smartly?
Now I only can figure out that replacing the html() when the intro is created. (although I still don't know how to do it exactly )
Template.intro.onCreated(function(){
$('html').html('the external code');
});
The simple and dirty way is to put all js, css, and html into public\ directory of your meteor app since this directoy is served "as is"
After that you can start converting your js files (taking into account local and global namespaces) and convert html files into Handlebars templates. Converted files you should move to client folder. Css files you can put in client folder to allow its minification and remove references to css files from Handlebars templates of html pages.
/public folder is usually used for static files like images. I suggest putting everything in a client folder. Usually there will be a lot of redundant js files coming with the template (bootstrap, jquery, fontawesome, etc). Best thing to do is use http://atmospherejs.com/ packages for those libraries and you will most likely be left with the templatename.js file which deals with the html within that template which you'll have to "meteorise"
I am new to bootstrap. I downloaded a wrapbootstrap theme and is trying to include that in my website. In the downloaded theme, there are several folders under a folder called assets, like bootstrap, css, js, icons, img. Under bootstrap folder there are again subfolders called css, fonts and js. Can anyone please tell me where exactly in the project should i add these files? In case of a simple theme, I know we need to add the bootstrap css under Content folder and the bootstrap js under Scripts folder and we need to add it in BundleConfig.cs. But here, since there are different css files and js files, where can I include them?
Thanks in advance.
Where the files are located is really irrelevant so far as your application is concerned. The ~/Scripts and ~/Content folders are just a default convention that Visual Studio uses with the templates.
However, nothing is preventing you from moving them. When working with a template, you have one of two choices.
Leave the files as they are, and simply reference them, or include them into bundles in the paths they are located in.
Determine which CSS and JS files you need, and re-shuffle everything to suit your particular projects needs.
The first option makes it easier to upgrade the template in the future, while the second option makes your project files more coherent because they follow a similar structure.
At the end of the day though... it's all just a resource location for you web server to resolve. Do whatever makes sense for your project.
In my webdesign process i use jade, sass, coffe etc. to generate static files via a GruntJS watch task into a dev folder. And most of the times after the build process is done, a cms comes along and want some templates to work. Thats usually html files with some php/ruby/python tags in it. Let´s say it´s a Wordpress Theme.
The Problem is:
i have to modify my generated files in the dev folder directly
when im modifing my source jade, html, coffee - files, the dev folder would be overwritten
if i clone the static files and move them into the theme folder, i have to apply manually every change i made to the src/dev folder to the cloned theme template files.
that´s very odd. So i´am in need of a grunt task that maybe...
generate the templates for me out of the static files (via a json mapping file)
generate the templates directly from the src files via special attributes, comments or something similar
There´s just one thread i found where the user tries to accomplish the same with jsdom.
Can someone help me to find a existing tool that accomplish such a task or do i have to build it on my own?
Thanks, Robert
Check out grunt-usemin
Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views)
Which file we should upload to server .scss or .css when we use Sass?
I read about Sass and Compass it makes these folders and files
I write scss in which gives output in .css file of same name.
My question do i need update whole folder to FTP or just .css file.?
I work with both .net and .php based websites.
the css is what the html pages will refer to. So thats the one you need to upload.
For source control, you only really need to keep the sass.
If you do not intend to do the compiling job on the server (like many Rails developers did with Capistrano), then no need to upload any sass files onto it. As Keith suggested, you need to keep sass files in source control repository and upload the css files. It's just like (more or less) compiling a c source code into binary executive files.