简体   繁体   English

Grunt结合了SCSS和CSS文件

[英]Grunt combine SCSS and CSS files

In my application SCSS files gets compiled to CSS files and all the files included in one main.css file. 在我的应用程序中,SCSS文件被编译为CSS文件,并且所有文件都包含在一个main.css文件中。 There are some other CSS files which also gets included in main.css file, how can I using Grunt create one CSS file from all these CSS and SCSS files? 还有一些其他CSS文件也包含在main.css文件中,如何使用Grunt从所有这些CSS和SCSS文件中创建一个CSS文件?

Note: All my CSS file is in client folder and SCSS file after compilation goes to public folder. 注意:我所有的CSS文件都在客户端文件夹中,编译后的SCSS文件转到公用文件夹中。

MSK MSK

What you are looking for is (file)- concatination . 您正在寻找的是(file) -conatination

There is an excellent plugin for grunt: grunt-contrib-concat 有一个很好的grunt插件: grunt-contrib-concat

Example-Configuration (static): 示例配置(静态):

concat: {
    dist: {
        //Add your files to src
        src: [
          'client-folder/file1.css',
          'public/compiled.css'
           ],
      dest: 'output/style.css',
    },
},

Example-Configuration (dynamic): 示例配置(动态):

concat: {
    dist: {
        src: [
          //Will use all .css files in client-folder/
          'client-folder/**.css',
          'public/compiled.css'
           ],
      dest: 'output/style.css',
    },
},

grunt concat:dist will then concat the content of your src files into the dest file. 然后grunt concat:distsrc文件的内容合并到dest文件中。

You can dig deeper into the documentation for more grunting fun. 您可以更深入地阅读文档,从而获得更多乐趣。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM