Skip to content
Permalink
Browse files
update grunt-sass to 3.0
  • Loading branch information
chinchang committed Nov 16, 2018
1 parent a7f60b7 commit bc4a76f8d207bac2678f54e1fcd47dc820db5349
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
@@ -1,27 +1,34 @@
/*global module:false*/
module.exports = function(grunt) {

const sass = require("node-sass");

module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pkg: grunt.file.readJSON("package.json"),

meta: {
getBanner: function () {
return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= meta.banner %>';
getBanner: function() {
return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= meta.banner %>";
},
getBannerForBaseVersion: function () {
return '/*! <%= pkg.title || pkg.name %> (base version) - v<%= pkg.version %> - <%= meta.banner %>';
getBannerForBaseVersion: function() {
return "/*! <%= pkg.title || pkg.name %> (base version) - v<%= pkg.version %> - <%= meta.banner %>";
},
banner: '<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' +
banner:
'<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> */\n\n'
},

sass: {
options: {
implementation: sass,
sourceMap: false
},
dist: {
files: {
'<%= pkg.name %>.css': 'src/<%= pkg.name %>.scss',
'<%= pkg.name %>.base.css': 'src/<%= pkg.name %>.base.scss'
"<%= pkg.name %>.css": "src/<%= pkg.name %>.scss",
"<%= pkg.name %>.base.css": "src/<%= pkg.name %>.base.scss"
}
}
},
@@ -32,55 +39,54 @@ module.exports = function(grunt) {
},
compress: {
files: {
'<%= pkg.name %>.min.css': [ '<%= pkg.name %>.css' ],
'<%= pkg.name %>.base.min.css': [ '<%= pkg.name %>.base.css' ]
"<%= pkg.name %>.min.css": ["<%= pkg.name %>.css"],
"<%= pkg.name %>.base.min.css": ["<%= pkg.name %>.base.css"]
}
}
},

// concat banner to final lib files
concat: {
options: {
banner: '<%= meta.getBanner() %>'
banner: "<%= meta.getBanner() %>"
},
lib: {
src: ['<%= pkg.name %>.css'],
dest: '<%= pkg.name %>.css'
src: ["<%= pkg.name %>.css"],
dest: "<%= pkg.name %>.css"
},
minLib: {
src: ['<%= pkg.name %>.min.css'],
dest: '<%= pkg.name %>.min.css'
src: ["<%= pkg.name %>.min.css"],
dest: "<%= pkg.name %>.min.css"
},
baseLib: {
options: {
banner: '<%= meta.getBannerForBaseVersion() %>'
banner: "<%= meta.getBannerForBaseVersion() %>"
},
src: ['<%= pkg.name %>.base.css'],
dest: '<%= pkg.name %>.base.css'
src: ["<%= pkg.name %>.base.css"],
dest: "<%= pkg.name %>.base.css"
},
baseMinLib: {
options: {
banner: '<%= meta.getBannerForBaseVersion() %>'
banner: "<%= meta.getBannerForBaseVersion() %>"
},
src: ['<%= pkg.name %>.base.min.css'],
dest: '<%= pkg.name %>.base.min.css'
src: ["<%= pkg.name %>.base.min.css"],
dest: "<%= pkg.name %>.base.min.css"
}
},

watch: {
files: 'src/*.scss',
tasks: 'default'
files: "src/*.scss",
tasks: "default"
}
});

// Dependencies
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks("grunt-sass");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-watch");

// Default task.
grunt.registerTask('default', 'sass');
grunt.registerTask('deploy', ['sass', 'cssmin', 'concat']);

grunt.registerTask("default", "sass");
grunt.registerTask("deploy", ["sass", "cssmin", "concat"]);
};
@@ -32,6 +32,7 @@
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-cssmin": "~0.12.3",
"grunt-contrib-watch": "~0.5.3",
"grunt-sass": "^1.1.0"
"grunt-sass": "^3.0.2",
"node-sass": "^4.10.0"
}
}

0 comments on commit bc4a76f

Please sign in to comment.