2014-10-02 13:36:05 +04:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
"use strict";
|
|
|
|
|
2014-10-03 23:15:31 +04:00
|
|
|
require("load-grunt-tasks")(grunt);
|
2014-10-03 19:13:28 +04:00
|
|
|
|
2014-10-02 13:36:05 +04:00
|
|
|
grunt.initConfig({
|
|
|
|
|
|
|
|
less: {
|
|
|
|
production: {
|
|
|
|
options: {
|
|
|
|
paths: ["less"]
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"css-compiled/material.css": "less/material.less",
|
|
|
|
"css-compiled/material-wfont.css": "less/material-wfont.less",
|
|
|
|
"css-compiled/ripples.css": "less/ripples.less"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-10-03 15:58:24 +04:00
|
|
|
sass: {
|
|
|
|
production: {
|
|
|
|
files: {
|
|
|
|
"css-compiled/material.css": "sass/material.scss",
|
|
|
|
"css-compiled/material-wfont.css": "sass/material-wfont.scss",
|
|
|
|
"css-compiled/ripples.css": "sass/ripples.scss"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-10-02 13:36:05 +04:00
|
|
|
autoprefixer: {
|
|
|
|
options: {
|
|
|
|
browsers: ["last 3 versions", "ie 8", "ie 9", "ie 10", "ie 11"]
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
files: {
|
|
|
|
"css-compiled/material.css": "css-compiled/material.css",
|
|
|
|
"css-compiled/material-wfont.css": "css-compiled/material-wfont.css",
|
|
|
|
"css-compiled/ripples.css": "css-compiled/ripples.css"
|
|
|
|
}
|
2014-10-03 19:13:28 +04:00
|
|
|
}
|
2014-10-02 13:36:05 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
cssmin: {
|
|
|
|
minify: {
|
|
|
|
expand: true,
|
|
|
|
cwd: "css-compiled/",
|
|
|
|
src: ["*.css", "!*.min.css"],
|
|
|
|
dest: "css-compiled/",
|
|
|
|
ext: ".min.css"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
copy: {
|
|
|
|
css: {
|
|
|
|
src: "css-compiled/*.min.css",
|
|
|
|
dest: "template/material/"
|
|
|
|
},
|
|
|
|
js: {
|
|
|
|
src: "scripts/*.js",
|
|
|
|
dest: "template/material/"
|
|
|
|
}
|
|
|
|
|
2014-10-03 23:15:31 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
connect: {
|
|
|
|
options: {
|
|
|
|
port: 8040,
|
|
|
|
hostname: "localhost",
|
2014-10-04 00:58:06 +04:00
|
|
|
livereload: 35729
|
2014-10-03 23:15:31 +04:00
|
|
|
|
|
|
|
},
|
|
|
|
livereload: {
|
|
|
|
options: {
|
|
|
|
open: true,
|
|
|
|
base: "."
|
|
|
|
}
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
options: {
|
|
|
|
port: 8041,
|
2014-10-04 00:13:48 +04:00
|
|
|
open: "http://localhost:8041/_SpecRunner.html",
|
2014-10-03 23:46:35 +04:00
|
|
|
base: "."
|
2014-10-03 23:15:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
jasmine: {
|
2014-10-04 00:13:48 +04:00
|
|
|
scripts: "scripts/**/*.js",
|
2014-10-03 23:15:31 +04:00
|
|
|
options: {
|
2014-10-03 23:46:35 +04:00
|
|
|
build: true,
|
2014-10-04 00:13:48 +04:00
|
|
|
specs: "test/*Spec.js",
|
|
|
|
helpers: "test/*Helper.js",
|
2014-10-03 23:15:31 +04:00
|
|
|
vendor: [
|
2014-10-04 00:13:48 +04:00
|
|
|
"https://code.jquery.com/jquery-1.10.2.min.js",
|
|
|
|
"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"
|
2014-10-03 23:15:31 +04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
jshintrc: ".jshintrc",
|
|
|
|
reporter: require("jshint-stylish")
|
|
|
|
},
|
|
|
|
all: [
|
|
|
|
"Gruntfile.js",
|
|
|
|
"scripts/**/*.js",
|
2014-10-04 00:13:48 +04:00
|
|
|
"template/**/*.js"
|
2014-10-03 23:15:31 +04:00
|
|
|
],
|
|
|
|
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"]
|
|
|
|
},
|
2014-10-04 00:46:56 +04:00
|
|
|
less: {
|
|
|
|
files:["less/**/*.less"],
|
|
|
|
tasks: ["default"]
|
|
|
|
},
|
|
|
|
sass: {
|
|
|
|
files: ["sass/**/*.scss", "sass/**/*.sass"],
|
|
|
|
tasks: ["scss"]
|
|
|
|
},
|
2014-10-03 23:15:31 +04:00
|
|
|
livereload: {
|
|
|
|
options: {
|
|
|
|
livereload: "<%= connect.options.livereload %>"
|
|
|
|
},
|
|
|
|
files: [
|
2014-10-04 00:13:48 +04:00
|
|
|
"index.html",
|
|
|
|
"css-compiled/**/*.css",
|
|
|
|
"**/*.{png,jpg,jpeg,gif,webp,svg}"
|
2014-10-03 23:15:31 +04:00
|
|
|
]
|
|
|
|
}
|
2014-10-02 13:36:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2014-10-03 19:13:28 +04:00
|
|
|
|
2014-10-02 13:36:05 +04:00
|
|
|
grunt.registerTask("default", ["less", "autoprefixer", "cssmin", "copy"]);
|
2014-10-03 23:15:31 +04:00
|
|
|
|
2014-10-03 15:58:24 +04:00
|
|
|
grunt.registerTask("scss", ["sass", "autoprefixer", "cssmin", "copy"]);
|
2014-10-03 23:15:31 +04:00
|
|
|
|
|
|
|
grunt.registerTask("build", function(target) {
|
|
|
|
var buildType = "default";
|
|
|
|
if (target && target === "scss") {
|
|
|
|
buildType = "scss";
|
|
|
|
}
|
|
|
|
|
2014-10-03 23:46:35 +04:00
|
|
|
grunt.task.run(["newer:jshint", "jasmine:scripts", buildType]);
|
2014-10-03 23:15:31 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
grunt.registerTask("test", [
|
2014-10-03 23:46:35 +04:00
|
|
|
"jasmine:scripts:build",
|
2014-10-04 00:46:56 +04:00
|
|
|
"connect:test:keepalive"
|
2014-10-03 23:15:31 +04:00
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask("serve", function(target){
|
|
|
|
var buildTarget = "default";
|
|
|
|
if(target && target === "scss") {
|
|
|
|
buildTarget = "scss";
|
|
|
|
}
|
|
|
|
grunt.task.run([
|
|
|
|
"build:"+ buildTarget,
|
|
|
|
"connect:livereload",
|
|
|
|
"watch"
|
2014-10-04 00:13:48 +04:00
|
|
|
]);
|
2014-10-03 23:15:31 +04:00
|
|
|
});
|
2014-10-05 04:16:13 +04:00
|
|
|
|
|
|
|
grunt.registerTask('cibuild',["newer:jshint", "jasmine:scripts"]);
|
2014-10-02 13:36:05 +04:00
|
|
|
};
|