Using Grunt and keeping theme comments

I used Grunt to minify CSS then combine them together in my WordPress theme. I combined all the CSS into 1 file called main.css . However in order to register the theme I still need a style.css with theme comments. The issue is Grunt gets rid of comments. I would like to do achieve this in 1 http request vs 2. I would like to have all my css in style.css right below the theme comments and get rid of main.css. How can I accomplish this?


style.css may contain only comment with Theme Name: ... . It just tells to WordPress about your theme. You have no need to load style.css in theme through tag <link ... >.

So. Now you can leave your only one css file main.css with all styles in <head>.

Tags: Themes / Css

Similar questions

Grunt.js manipulate parent directory
I'm trying to make a build structure where files aren't just "floating about". The reason for this is that I'm using Drupal and don't want to have the gruntfile, package.json and "node_modules"-folder placed loosely in the "themes"-folder. My desired file structure: I'm using grunt-contrib-clean and want to clean up my "theme_name"-folder each time...
Grunt livereload with wordpress
Grunt livereload with wordpress Hi all I'm trying to use grunt with my wordpress theme development. Everything seems to be working fine about from the 'serve' task and the livereload. In the themes folder I have the gruntfile.js and package.json and dev-theme folder The dev-theme folder contains the theme files. I'm using the gruntfile below and in...
Grunt-contrib-compass: Unclear configuration error while trying to work with 2 projects
I am trying to get use of great David Hererra's advice on how to use grunt-contrib-compass with Wordpress parent and child themes. You can find his tutorial here: But to my question: I have 2 projects (parent theme and child theme) with 2 different importPaths. My gruntfile.js for both of them is sitting on the...
grunt sass add comment to output file
I'm using grunt sass to output my css in a Wordpress theme. I would normally output my css to thestyles.css and in the style.css use @import(thestyles.css) I'm using respond.js so I can't use @import in the style.css file. I want to output my css straight to the style.css but I need the comments at the top for Wordpress. Can I use banner to add the...
Grunt browser-sync not watching php file changes in Wordpress
I've set up grunt successfully to watch sass and js file changes in my Gruntfile.js. The only thing its not picking up are the changes to my php files. Looking at the documentation for browser-sync for Wrodpress, i need to state options like so: I've tried the commented out options aswell as a slightly differnt sytax setup at http://www.browsersync...
Use grunt with an existing wordpress instance
I'm trying to figure out how to minify & combine js/css code given this situation: I'm fairly new to grunt, I've used it in the past with custom web apps, but never with wordpress, I wonder if it can help when you have lots of PHP scripts / pluging which injects their ugly code. So my question is: is there a way to make grunt work with wordpres...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.