added source maps for LESS (fixes #196)

This commit is contained in:
FezVrasta 2014-11-26 13:28:22 +01:00
parent 0eb51de4e6
commit 8dd2272549
4 changed files with 218 additions and 189 deletions

View File

@ -1,201 +1,227 @@
module.exports = function(grunt) { module.exports = function(grunt) {
"use strict"; "use strict";
require("load-grunt-tasks")(grunt); require("load-grunt-tasks")(grunt);
grunt.initConfig({ grunt.initConfig({
less: { less: {
compileless: { material: {
options: { options: {
paths: ["less"] paths: ["less"],
}, sourceMap: true,
files: { sourceMapRootpath: "/",
"dist/css/material.css": "less/material.less", sourceMapFilename: "dist/css/material.css.map",
"dist/css/material-wfont.css": "less/material-wfont.less", sourceMapURL: "material.css.map"
"dist/css/ripples.css": "less/ripples.less"
}
}
}, },
files: {
sass: { "dist/css/material.css": "less/material.less",
compilesass: {
files: {
"dist/css/material.css": "sass/material.scss",
"dist/css/material-wfont.css": "sass/material-wfont.scss",
"dist/css/ripples.css": "sass/ripples.scss"
}
}
},
autoprefixer: {
options: {
browsers: ["last 3 versions", "ie 8", "ie 9", "ie 10", "ie 11"]
},
prefix: {
files: {
"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"
}
}
},
cssmin: {
minifycss: {
expand: true,
cwd: "dist/css/",
src: ["*.css", "!*.min.css"],
dest: "dist/css/",
ext: ".min.css"
}
},
uglify: {
options: {
sourceMap: true
},
minifyjs: {
files: {
"dist/js/material.min.js": "dist/js/material.js",
"dist/js/ripples.min.js": "dist/js/ripples.js"
}
}
},
copy: {
distjs: {
expand: true,
cwd: "scripts/",
src: "**.js",
dest: "dist/js/",
flatten: true,
filter: "isFile"
},
distfonts: {
expand: true,
cwd: "fonts/",
src: "**",
dest: "dist/fonts/",
flatten: true,
filter: "isFile"
}
},
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",
"dist/css/**/*.css",
"**/*.{png,jpg,jpeg,gif,webp,svg}"
]
}
} }
},
}); materialWfont: {
options: {
grunt.registerTask("default", ["less", "autoprefixer", "cssmin", "copy", "uglify"]); paths: ["less"],
sourceMap: true,
grunt.registerTask("scss", ["sass", "autoprefixer", "cssmin", "copy", "uglify"]); sourceMapRootpath: "/",
sourceMapFilename: "dist/css/material-wfont.css.map",
grunt.registerTask("build", function(target) { sourceMapURL: "material-wfont.css.map"
var buildType = "default"; },
if (target && target === "scss") { files: {
buildType = "scss"; "dist/css/material-wfont.css": "less/material-wfont.less",
} }
},
ripples: {
options: {
paths: ["less"],
sourceMap: true,
sourceMapRootpath: "/",
sourceMapFilename: "dist/css/ripples.css.map",
sourceMapURL: "ripples.css.map"
},
files: {
"dist/css/ripples.css": "less/ripples.less",
}
}
},
grunt.task.run(["newer:jshint", "jasmine:scripts", buildType]); sass: {
}); compilesass: {
files: {
"dist/css/material.css": "sass/material.scss",
"dist/css/material-wfont.css": "sass/material-wfont.scss",
"dist/css/ripples.css": "sass/ripples.scss"
}
}
},
grunt.registerTask("test", [ autoprefixer: {
"jasmine:scripts:build", options: {
"connect:test:keepalive" browsers: ["last 3 versions", "ie 8", "ie 9", "ie 10", "ie 11"]
},
prefix: {
files: {
"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"
}
}
},
cssmin: {
minifycss: {
expand: true,
cwd: "dist/css/",
src: ["*.css", "!*.min.css"],
dest: "dist/css/",
ext: ".min.css"
}
},
uglify: {
options: {
sourceMap: true
},
minifyjs: {
files: {
"dist/js/material.min.js": "dist/js/material.js",
"dist/js/ripples.min.js": "dist/js/ripples.js"
}
}
},
copy: {
distjs: {
expand: true,
cwd: "scripts/",
src: "**.js",
dest: "dist/js/",
flatten: true,
filter: "isFile"
},
distfonts: {
expand: true,
cwd: "fonts/",
src: "**",
dest: "dist/fonts/",
flatten: true,
filter: "isFile"
}
},
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",
"dist/css/**/*.css",
"**/*.{png,jpg,jpeg,gif,webp,svg}"
]
}
}
});
grunt.registerTask("default", ["less", "autoprefixer", "cssmin", "copy", "uglify"]);
grunt.registerTask("scss", ["sass", "autoprefixer", "cssmin", "copy", "uglify"]);
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"
]); ]);
});
grunt.registerTask("serve", function(target){ grunt.registerTask("cibuild",["newer:jshint", "jasmine:scripts"]);
var buildTarget = "default";
if(target && target === "scss") {
buildTarget = "scss";
}
grunt.task.run([
"build:"+ buildTarget,
"connect:livereload",
"watch"
]);
});
grunt.registerTask("cibuild",["newer:jshint", "jasmine:scripts"]);
}; };

1
dist/css/material-wfont.css.map vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/css/material.css.map vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/css/ripples.css.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["/less/ripples.less"],"names":[],"mappings":"AAAA;EACI,kBAAA;;AAEJ;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,UAAA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;EACA,sBAAA;;AAEJ;EACI,kBAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;EACA,iBAAA;EACA,mBAAA;EACA,qCAAA;EACA,WAAW,QAAX;EACA,qBAAA;EACA,UAAA;EACA,oBAAA;;AAEJ,OAAO;EACH,qDAAqD,iCAArD;EACA,YAAA;;AAEJ,OAAO;EACH,6CAAA;EACA,UAAA"}