mdb-ui-kit/Gruntfile.js

212 lines
5.8 KiB
JavaScript
Raw Normal View History

2014-10-02 13:36:05 +04:00
module.exports = function(grunt) {
"use strict";
require("load-grunt-tasks")(grunt);
2014-10-03 19:13:28 +04:00
2014-10-02 13:36:05 +04:00
grunt.initConfig({
less: {
2014-10-05 11:32:48 +04:00
compileless: {
2014-10-02 13:36:05 +04:00
options: {
paths: ["less"]
},
files: {
2014-10-05 11:32:48 +04:00
"dist/css/material.css": "less/material.less",
"dist/css/material-wfont.css": "less/material-wfont.less",
"dist/css/ripples.css": "less/ripples.less"
2014-10-02 13:36:05 +04:00
}
}
},
2014-10-28 11:40:58 +03:00
/*githooks: {
all: {
// Will run the jshint and test:unit tasks at every commit
"pre-commit": "less autoprefixer cssmin uglify copy newer:jshint jasmine:scripts"
}
2014-10-28 11:40:58 +03:00
}, */
2014-10-03 15:58:24 +04:00
sass: {
2014-10-05 11:32:48 +04:00
compilesass: {
2014-10-03 15:58:24 +04:00
files: {
2014-10-05 11:32:48 +04:00
"dist/css/material.css": "sass/material.scss",
"dist/css/material-wfont.css": "sass/material-wfont.scss",
"dist/css/ripples.css": "sass/ripples.scss"
2014-10-03 15:58:24 +04:00
}
}
},
2014-10-02 13:36:05 +04:00
autoprefixer: {
options: {
browsers: ["last 3 versions", "ie 8", "ie 9", "ie 10", "ie 11"]
},
2014-10-05 11:32:48 +04:00
prefix: {
2014-10-02 13:36:05 +04:00
files: {
2014-10-05 11:32:48 +04:00
"dist/css/material.css": "dist/css/material.css",
"dist/css/material-wfont.css": "dist/css/material-wfont.css",
"dist/css/ripples.css": "dist/css/ripples.css"
2014-10-02 13:36:05 +04:00
}
2014-10-03 19:13:28 +04:00
}
2014-10-02 13:36:05 +04:00
},
cssmin: {
2014-10-05 11:32:48 +04:00
minifycss: {
2014-10-02 13:36:05 +04:00
expand: true,
2014-10-05 11:32:48 +04:00
cwd: "dist/css/",
2014-10-02 13:36:05 +04:00
src: ["*.css", "!*.min.css"],
2014-10-05 11:32:48 +04:00
dest: "dist/css/",
2014-10-02 13:36:05 +04:00
ext: ".min.css"
}
},
2014-10-05 11:32:48 +04:00
uglify: {
minifyjs: {
files: {
"dist/js/material.min.js": "scripts/material.js",
"dist/js/ripples.min.js": "scripts/ripples.js"
}
}
},
2014-10-02 13:36:05 +04:00
copy: {
tpl: {
expand: true,
cwd: "dist/",
src: "**",
2014-10-02 13:36:05 +04:00
dest: "template/material/"
2014-10-05 11:32:48 +04:00
},
distjs: {
expand: true,
cwd: "scripts/",
src: "**",
dest: "dist/js/",
flatten: true,
filter: "isFile"
},
distfonts: {
expand: true,
cwd: "fonts/",
src: "**",
dest: "dist/fonts/",
flatten: true,
filter: "isFile"
2014-10-02 13:36:05 +04:00
}
},
connect: {
options: {
port: 8040,
hostname: "localhost",
livereload: 35729
},
livereload: {
options: {
open: true,
base: "."
}
},
test: {
options: {
port: 8041,
open: "http://localhost:8041/_SpecRunner.html",
base: "."
}
}
},
jasmine: {
scripts: "scripts/**/*.js",
options: {
build: true,
specs: "test/*Spec.js",
helpers: "test/*Helper.js",
vendor: [
"https://code.jquery.com/jquery-1.10.2.min.js",
"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"
]
}
},
jshint: {
options: {
jshintrc: ".jshintrc",
reporter: require("jshint-stylish")
},
all: [
"Gruntfile.js",
"scripts/**/*.js",
"template/**/*.js",
"!template/**/*.min.js"
],
test: {
options: {
jshintrc: "test/.jshintrc",
src: ["test/**/*.js"]
}
}
},
watch: {
js: {
files: ["Gruntfile.js", "scripts/**/*.js", "template/**/*.js"],
tasks: ["newer:jshint:all"]
},
jsTest: {
files: ["test/**/*.js"],
tasks: ["newer:jshint:test", "jasmine"]
},
less: {
files:["less/**/*.less"],
tasks: ["default"]
},
sass: {
files: ["sass/**/*.scss", "sass/**/*.sass"],
tasks: ["scss"]
},
livereload: {
options: {
livereload: "<%= connect.options.livereload %>"
},
files: [
"index.html",
2014-10-05 11:32:48 +04:00
"dist/css/**/*.css",
"**/*.{png,jpg,jpeg,gif,webp,svg}"
]
}
2014-10-02 13:36:05 +04:00
}
});
2014-10-03 19:13:28 +04:00
2014-10-28 11:40:58 +03:00
grunt.registerTask("default", ["less", "autoprefixer", "cssmin", "uglify", "copy"]);
2014-10-05 11:32:48 +04:00
grunt.registerTask("scss", ["sass", "autoprefixer", "cssmin", "uglify", "copy"]);
grunt.registerTask("build", function(target) {
var buildType = "default";
if (target && target === "scss") {
buildType = "scss";
}
grunt.task.run(["newer:jshint", "jasmine:scripts", buildType]);
});
grunt.registerTask("test", [
"jasmine:scripts:build",
"connect:test:keepalive"
]);
grunt.registerTask("serve", function(target){
var buildTarget = "default";
if(target && target === "scss") {
buildTarget = "scss";
}
grunt.task.run([
"build:"+ buildTarget,
"connect:livereload",
"watch"
]);
});
2014-10-05 04:16:13 +04:00
2014-10-05 10:57:23 +04:00
grunt.registerTask("cibuild",["newer:jshint", "jasmine:scripts"]);
2014-10-02 13:36:05 +04:00
};