import .css file into .less file

后端 未结 9 768
渐次进展
渐次进展 2020-11-28 01:35

Can you import .css files into .less files...?

I\'m pretty familiar with less and use it for all my development. I regularly use a structure as follows:



        
相关标签:
9条回答
  • 2020-11-28 02:12

    I had to use the following with version 1.7.4

    @import (less) "foo.css"
    

    I know the accepted answer is @import (css) "foo.css" but it didn't work. If you want to reuse your css class in your new less file, you need to use (less) and not (css).

    Check the documentation.

    0 讨论(0)
  • 2020-11-28 02:14

    You can force a file to be interpreted as a particular type by specifying an option, e.g.:

    @import (css) "lib";
    

    will output

    @import "lib";
    

    and

    @import (less) "lib.css";
    

    will import the lib.css file and treat it as less. If you specify a file is less and do not include an extension, none will be added.

    0 讨论(0)
  • 2020-11-28 02:15

    Try this :

    @import "lib.css";
    

    From the Official Documentation :

    You can import both css and less files. Only less files import statements are processed, css file import statements are kept as they are. If you want to import a CSS file, and don’t want LESS to process it, just use the .css extension:


    Source : http://lesscss.org/

    0 讨论(0)
提交回复
热议问题