Keep Comment in Compressed SASS / SCSS Output

If you are writing your WordPress Theme CSS with SASS and need to keep the first comment with the theme name, license, tags, etc. when compiling your style.css compressed, then you will need to use a so called loud comment.

Loud comments start by including an exclamation mark like this:

/*!
Theme Name: The Best Theme Ever
Theme URI: http://richwp.com/themes/best-theme-ever/
Author: Felix Krusch
Author URI: http://richwp.com/
Description: A mobile first, responsive blogging theme with a minimalistic design.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, gray, white, one-column, two-columns, right-sidebar
*/

… instead of starting with just:

/*

The compiled and compressed output will not include the exclamation mark.

4 thoughts on “Keep Comment in Compressed SASS / SCSS Output”

  1. Learning something new every day. :) Even though this is a post made in 2013 still useful in 2017!

    Thank you`.

  2. This is awesome! I’m using rtlcss to create a version of a site in Arabic. I use SASS to compile a styles.css file and then run rtlcss to create the Arabic version. In the CSS you write value directives for edge cases; like arrow direction. This tip was the solution I was looking for.

    .icon-prev,
    .icon-next {
    z-index: 4;

    /*horizontal flip*/ /*left-right mirror*/
    /*!rtl:raw:
    -moz-transform: scale(-1, 1);
    -webkit-transform: scale(-1, 1);
    -o-transform: scale(-1, 1);
    -ms-transform: scale(-1, 1);
    transform: scale(-1, 1);
    */
    }

Leave a Reply

Your email address will not be published. Required fields are marked *