punch icon indicating copy to clipboard operation
punch copied to clipboard

Less @imports

Open ghost opened this issue 12 years ago • 6 comments

I can't seem to get Less @imports to work, I get the following error when trying to do @import "normalize.less";:

/usr/local/lib/node_modules/punch/node_modules/less/lib/less/parser.js:418
                        else                                  throw new(LessEr

Is this possible and I'm just doing something wrong?

ghost avatar Oct 17 '12 21:10 ghost

Also, /* comment */ style comments are getting stripped, the Less documentation says that it should leave these alone.

ghost avatar Oct 17 '12 22:10 ghost

Are you using the latest version of Punch? (You can check the version by running punch -v. Latest version should be 0.4.16)

If you give the correct relative path for the file you're trying to import in the LESS stylesheet, it should be imported correctly.

I'll check on comment stripping issue.

laktek avatar Oct 18 '12 01:10 laktek

Yes, using latest version, and correct relative path.

ghost avatar Oct 18 '12 06:10 ghost

Sorry for the delay in getting back to you on this issue. But from my end I couldn't find any issues with LESS import. Can you share how your stylesheet directory is structured?

Also, CSS style comments are not getting stripped from the generated stylesheets (unless you bundle them with the asset bundler, which does minify the styles).

laktek avatar Oct 23 '12 05:10 laktek

I got the imports working in the end, not entirely sure what I was doing wrong in the beginning.

With regards the asset bundler, I'm guessing it uses something like Uglify... all I really need it to put a copyright notice at the top of the compressed stylesheet, would there be an easy way to achieve this or give options to the compressor?

ghost avatar Oct 23 '12 10:10 ghost

@thelucid Using the following identifiers I believe can help preserve comments in the css:

/*!    */

Example

/*!
 Copyright 2013 Author 
 Here is the copyright 
 */

I hope this helps.

bjfish avatar Oct 17 '13 18:10 bjfish