balexand
balexand

Reputation: 9665

Prepend comment to SASS/Compass output

Is there a convenient way to have SASS automatically prepend a comment to the beginning of each CSS output file? Specifically, when using Compasss I'd like to stick a brief warning telling designers not to edit the CSS directly and to point them to instructions on getting started with Compass. I use an output style of :compressed, which strips out comments that are in the input SCSS/SASS file.

If there isn't a convenient way to do this then I'll submit an issue/patch. I was thinking of adding an option named :output_prefix that takes a String that will be prepended to all output CSS files.

Upvotes: 4

Views: 2638

Answers (3)

Jason
Jason

Reputation: 3179

Known bug in Sass. Fixed in master but not yet released:

https://github.com/nex3/sass/issues/784

Upvotes: 0

hopper
hopper

Reputation: 13390

From the SASS reference on comments:

When the first letter of a comment is !, the comment will be interpolated and always rendered into css output even in compressed output modes. This is useful for adding Copyright notices to your generated CSS.

So you could start your SASS file with something like this:

/*!
 * WARNING: Don't edit this file by hand! Instead, you should be using Compass.
 * (More information at http://compass-style.org/)
 */

Upvotes: 14

chriseppstein
chriseppstein

Reputation: 10613

compressed strips out all comments. I suggest you put this in a property:

warning { do-not: "edit this file"; }

Regarding the proposed patch, I do not think this use case is compelling enough to warrant such a feature.

Upvotes: 0

Related Questions