简体   繁体   中英

How to combine file and not minify them using grunt

I have the following grunt file:

module.exports = function(grunt) {

  grunt.initConfig({
    cssmin: {
      options: {
        shorthandCompacting: false,
        roundingPrecision: -1
      },
      target: {
        files: {
          'css/output.css': ['css/one.css', 'css/two.css']
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.registerTask('default', ['cssmin']);

};

just started using grunt.js today and just had a look at the documentation and the examples , i am using the following plugin:

CSS-CONTRIB-MIN

Now, My files get minifined into one , but what i really want is for them to only be combined into one and not minified. how do i achieve that ?

You should use the grunt-contrib-concat plugin for this task. Take a closer look at the GitHub documentation on how to configure the task (eg separator, banner, ...)

grunt.initConfig({
  concat: {
    dist: {
      src: ['css/one.css', 'css/two.css'],
      dest: 'css/output.css',
    },
  },
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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