2015-11-04 23:49:03 +03:00
|
|
|
module.exports = function (grunt) {
|
2014-11-26 15:28:22 +03:00
|
|
|
"use strict";
|
2014-10-02 13:36:05 +04:00
|
|
|
|
2014-11-26 15:28:22 +03:00
|
|
|
require("load-grunt-tasks")(grunt);
|
2014-10-05 11:32:48 +04:00
|
|
|
|
2015-11-20 23:24:39 +03:00
|
|
|
var path = require('path');
|
|
|
|
var configBridge = grunt.file.readJSON('./grunt/configBridge.json', {encoding: 'utf8'});
|
|
|
|
var generateIconsData = require('./grunt/bmd-icons-data-generator.js');
|
|
|
|
|
|
|
|
Object.keys(configBridge.paths).forEach(function (key) {
|
|
|
|
configBridge.paths[key].forEach(function (val, i, arr) {
|
|
|
|
arr[i] = path.join('./docs/assets', val);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-11-26 15:28:22 +03:00
|
|
|
grunt.initConfig({
|
2014-10-03 23:15:31 +04:00
|
|
|
|
2015-11-21 00:17:08 +03:00
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2015-11-20 23:24:39 +03:00
|
|
|
jqueryCheck: configBridge.config.jqueryCheck.join('\n'),
|
|
|
|
jqueryVersionCheck: configBridge.config.jqueryVersionCheck.join('\n'),
|
|
|
|
|
|
|
|
|
2015-11-20 21:21:02 +03:00
|
|
|
// Task configuration.
|
|
|
|
clean: {
|
|
|
|
dist: 'dist',
|
|
|
|
docs: 'docs/dist'
|
|
|
|
},
|
|
|
|
|
2015-11-20 00:58:21 +03:00
|
|
|
jekyll: {
|
|
|
|
options: {
|
|
|
|
config: '_config.yml'
|
|
|
|
},
|
|
|
|
docs: {},
|
|
|
|
github: {
|
|
|
|
options: {
|
|
|
|
raw: 'github: true'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-21 00:17:08 +03:00
|
|
|
htmlmin: {
|
|
|
|
dist: {
|
|
|
|
options: {
|
|
|
|
collapseWhitespace: true,
|
|
|
|
conservativeCollapse: true,
|
|
|
|
minifyCSS: true,
|
|
|
|
minifyJS: true,
|
|
|
|
removeAttributeQuotes: true,
|
|
|
|
removeComments: true
|
|
|
|
},
|
|
|
|
expand: true,
|
|
|
|
cwd: '_gh_pages',
|
|
|
|
dest: '_gh_pages',
|
|
|
|
src: [
|
|
|
|
'**/*.html',
|
|
|
|
'!examples/**/*.html'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-07 02:41:39 +03:00
|
|
|
htmllint: {
|
|
|
|
//options: {
|
|
|
|
// stoponerror: false,
|
|
|
|
// relaxerror: []
|
|
|
|
//},
|
|
|
|
//files: ['index.html', 'bootstrap-elements.html']
|
|
|
|
all: {
|
|
|
|
options: {
|
|
|
|
ignore: '“&” did not start a character reference. (“&” probably should have been escaped as “&”.)'
|
|
|
|
},
|
|
|
|
src: ["*.html"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// Make sure we are structurally correct for bootstrap
|
|
|
|
bootlint: {
|
|
|
|
options: {
|
|
|
|
stoponerror: false,
|
|
|
|
relaxerror: []
|
|
|
|
},
|
|
|
|
files: ['index.html', 'bootstrap-elements.html']
|
|
|
|
},
|
2015-11-20 00:58:21 +03:00
|
|
|
|
2015-11-02 22:42:29 +03:00
|
|
|
// Convert from less to sass
|
2015-11-02 23:39:13 +03:00
|
|
|
lessToSass: {
|
2015-11-02 22:42:29 +03:00
|
|
|
convert: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
2015-11-05 17:11:38 +03:00
|
|
|
cwd: "less",
|
2015-11-22 19:23:34 +03:00
|
|
|
src: ["*.less", "!_mixins.less", "!_import-bs*"],
|
2015-11-05 17:11:38 +03:00
|
|
|
ext: ".scss",
|
|
|
|
dest: "sass"
|
2015-11-03 04:17:00 +03:00
|
|
|
}],
|
|
|
|
options: {
|
|
|
|
replacements: [
|
2015-11-05 00:57:47 +03:00
|
|
|
|
2015-11-21 16:43:52 +03:00
|
|
|
// convert bootstrap imports
|
|
|
|
{ // https://regex101.com/r/bM6cP0/2
|
|
|
|
pattern: /bower_components\/(bootstrap\/less\/)/gi,
|
|
|
|
replacement: "bower_components\/bootstrap-sass\/assets\/stylesheets\/bootstrap\/",
|
|
|
|
order: 2
|
|
|
|
},
|
|
|
|
|
2015-11-22 00:35:17 +03:00
|
|
|
// convert conditional when not
|
|
|
|
{ // https://regex101.com/r/cX6uF4/1
|
|
|
|
pattern: /& when not \(isstring\(\$parent\)\)/gi,
|
|
|
|
replacement: "@if not $parent",
|
|
|
|
order: 2
|
|
|
|
},
|
|
|
|
|
|
|
|
// convert conditional when
|
|
|
|
{ // https://regex101.com/r/gH0jP0/2
|
|
|
|
pattern: /& when \(isstring\(\$parent\)\)/gi,
|
|
|
|
replacement: "@else",
|
|
|
|
order: 2
|
|
|
|
},
|
|
|
|
|
2015-11-05 00:57:47 +03:00
|
|
|
// convert all shadow mixins
|
|
|
|
{ // https://regex101.com/r/sJ2lH4/1
|
|
|
|
pattern: /.shadow-z-(\d+)((?:-hover)?) {/gi,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@mixin shadow-z-$1$2 {",
|
2015-11-04 23:49:03 +03:00
|
|
|
order: 2
|
2015-11-03 04:17:00 +03:00
|
|
|
},
|
2015-11-05 00:40:12 +03:00
|
|
|
// bad conversions of .shadow-z-*
|
2015-11-05 00:57:47 +03:00
|
|
|
{ // https://regex101.com/r/pV0yB0/3
|
2015-11-05 00:40:12 +03:00
|
|
|
pattern: /\.shadow-z-(\d+)((?:-hover)?)(?:\(\))?;/gi,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@include shadow-z-$1$2;",
|
2015-11-05 00:40:12 +03:00
|
|
|
order: 2
|
|
|
|
},
|
|
|
|
|
2015-11-03 21:33:54 +03:00
|
|
|
// bad conversions to @include instead of @extend
|
|
|
|
{
|
2015-11-03 04:17:00 +03:00
|
|
|
pattern: /@include (foo1|foo2)\(\);/gi,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@extend .$1;",
|
2015-11-03 04:17:00 +03:00
|
|
|
order: 2
|
2015-11-03 20:28:56 +03:00
|
|
|
},
|
|
|
|
|
2015-11-05 00:40:12 +03:00
|
|
|
// hack - (no conditional replacements)
|
|
|
|
{ // https://regex101.com/r/pV0yB0/2
|
|
|
|
pattern: /@extend @extend/gi,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@extend",
|
2015-11-05 00:40:12 +03:00
|
|
|
order: 10
|
|
|
|
},
|
|
|
|
|
2015-11-03 20:28:56 +03:00
|
|
|
// button variations mixin replacement(s)
|
2015-11-03 21:28:56 +03:00
|
|
|
{ // Multi-line replacement - https://regex101.com/r/qD9qB8/2
|
2015-11-03 21:12:20 +03:00
|
|
|
pattern: /.generic-variations\(unquote\(("[^"]+")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+?(?!\r|\n)contrast[\s\S]+?(?!\r|\n)(\d+)[\s\S]+?(?!\r|\n)}\);$\n/mg,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@include button-variations(unquote($1), $2, $3%);\n",
|
2015-11-03 21:12:20 +03:00
|
|
|
order: 20
|
2015-11-03 21:28:56 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// background-color generic-variations
|
|
|
|
{ // Multi-line replacement - https://regex101.com/r/cW6pH8/2
|
|
|
|
pattern: /.generic-variations\(unquote\(("[^"]+")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+?(?!\r|\n)background-color[\s\S]+?(?!\r|\n)(\(\d+\/\d+\))[\s\S]+?(?!\r|\n)}\);$\n/mg,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@include bg-color-variations(unquote($1), $2, $3);\n",
|
2015-11-03 21:28:56 +03:00
|
|
|
order: 21
|
2015-11-04 23:34:47 +03:00
|
|
|
},
|
2015-11-03 04:17:00 +03:00
|
|
|
|
2015-11-04 23:34:47 +03:00
|
|
|
// bg-box-shadow generic-variations
|
|
|
|
{ // Multi-line replacement - https://regex101.com/r/jW8kR1/1
|
|
|
|
pattern: /.generic-variations\(unquote\(("[^"]+")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+?(?!\r|\n)box-shadow[\s\S]+?(?!\r|\n)[\s\S]+?(?!\r|\n)}\);$\n/mg,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@include bg-box-shadow-variations(unquote($1), $2);\n",
|
2015-11-04 23:34:47 +03:00
|
|
|
order: 22
|
2015-11-04 23:41:37 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// bg-img generic-variations
|
|
|
|
{ // Multi-line replacement - https://regex101.com/r/aP2hH2/1
|
|
|
|
pattern: /.generic-variations\(unquote\(("[^"]+")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+?(?!\r|\n)background-image[\s\S]+?(?!\r|\n)[\s\S]+?(?!\r|\n)}\);$\n/mg,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@include bg-img-variations(unquote($1), $2);\n",
|
2015-11-04 23:41:37 +03:00
|
|
|
order: 23
|
2015-11-04 23:49:03 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// navbar generic-variations
|
|
|
|
{ // Multi-line replacement - https://regex101.com/r/lX1hH1/1
|
|
|
|
pattern: /.generic-variations\(unquote\((".navbar")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+?(?!\r|\n)[\s\S]+?(?!\r|\n)[\s\S]+?(?!\r|\n)}\);$\n/mg,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@include navbar-variations(unquote($1), $2);\n",
|
2015-11-04 23:49:03 +03:00
|
|
|
order: 24
|
|
|
|
},
|
2015-11-05 00:00:44 +03:00
|
|
|
|
2015-11-10 22:36:15 +03:00
|
|
|
// material-placehorder
|
|
|
|
{ // Multi-line replacement - https://regex101.com/r/eS2vQ3/2
|
|
|
|
pattern: /.material-placeholder\({$\n([\s\S]+?)}\);$\n/mg,
|
|
|
|
replacement: "@include material-placeholder {\n$1\n}\n",
|
|
|
|
order: 24
|
|
|
|
},
|
2015-11-05 02:02:39 +03:00
|
|
|
|
|
|
|
// fix calc references
|
|
|
|
{ // https://regex101.com/r/aZ8iI5/1
|
|
|
|
pattern: /calc\(unquote\("([^"]+)"\)\)/gi,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "calc($1)",
|
2015-11-05 02:02:39 +03:00
|
|
|
order: 24
|
|
|
|
},
|
|
|
|
|
2015-11-05 00:00:44 +03:00
|
|
|
// alert generic-variations (convert this one last - very broad search)
|
|
|
|
{ // Multi-line replacement - https://regex101.com/r/jB1uL1/1
|
|
|
|
pattern: /.generic-variations\(unquote\(("([^"]+)?")\), (\$[\s\S]+?(?!\r|\n)), {$\n[\s\S]+}\);$\n/mg,
|
2015-11-05 17:11:38 +03:00
|
|
|
replacement: "@include alert-variations(unquote($1), $3);\n",
|
2015-11-05 00:00:44 +03:00
|
|
|
order: 250 // very broad search, do this last
|
2015-11-05 01:54:57 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// auto generated notice
|
|
|
|
{ // Multi-line replacement - https://regex101.com/r/aR2kT5/1
|
|
|
|
pattern: /([\s\S]+)/mg,
|
2015-11-05 17:25:02 +03:00
|
|
|
replacement: "\/\/ This file has been autogenerated by grunt task lessToSass. Any changes will be overwritten.\n\n$1",
|
2015-11-05 01:54:57 +03:00
|
|
|
order: 1000 // very broad search, do this last
|
|
|
|
},
|
|
|
|
|
2015-11-04 23:49:03 +03:00
|
|
|
]
|
2015-11-03 04:17:00 +03:00
|
|
|
}
|
2015-11-02 22:42:29 +03:00
|
|
|
}
|
|
|
|
},
|
2014-12-04 15:17:45 +03:00
|
|
|
|
2015-11-03 02:55:59 +03:00
|
|
|
// Test compile sass
|
|
|
|
sass: {
|
|
|
|
compile: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
2015-11-05 17:11:38 +03:00
|
|
|
cwd: "sass",
|
2015-11-24 02:43:41 +03:00
|
|
|
src: ["bootstrap-material-design.scss", "ripples.scss"],
|
2015-11-05 17:25:02 +03:00
|
|
|
dest: "dist/sassc", // added to gitignore, only used for local testing
|
2015-11-05 17:11:38 +03:00
|
|
|
ext: ".css"
|
2015-11-03 02:55:59 +03:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-12-04 15:17:45 +03:00
|
|
|
// Compile less to .css
|
|
|
|
// Compile less to .min.css
|
|
|
|
// Create source maps of both
|
2014-11-26 15:28:22 +03:00
|
|
|
less: {
|
|
|
|
material: {
|
|
|
|
options: {
|
|
|
|
paths: ["less"],
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapRootpath: "/",
|
2015-11-22 19:23:34 +03:00
|
|
|
sourceMapFilename: "dist/css/bootstrap-material-design.css.map",
|
|
|
|
sourceMapURL: "bootstrap-material-design.css.map"
|
2014-10-03 23:15:31 +04:00
|
|
|
},
|
2014-11-26 15:28:22 +03:00
|
|
|
files: {
|
2015-11-22 19:23:34 +03:00
|
|
|
"dist/css/bootstrap-material-design.css": "less/bootstrap-material-design.less",
|
2015-03-09 19:10:44 +03:00
|
|
|
}
|
|
|
|
},
|
2014-11-26 15:28:22 +03:00
|
|
|
ripples: {
|
|
|
|
options: {
|
|
|
|
paths: ["less"],
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapRootpath: "/",
|
|
|
|
sourceMapFilename: "dist/css/ripples.css.map",
|
2014-12-04 15:17:45 +03:00
|
|
|
sourceMapURL: "ripples.css.map",
|
|
|
|
outputSourceFiles: true
|
2014-10-03 23:15:31 +04:00
|
|
|
},
|
2014-11-26 15:28:22 +03:00
|
|
|
files: {
|
|
|
|
"dist/css/ripples.css": "less/ripples.less",
|
2014-10-02 13:36:05 +04:00
|
|
|
}
|
2015-11-21 01:18:58 +03:00
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
options: {
|
|
|
|
paths: ["less"],
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapRootpath: "/",
|
|
|
|
sourceMapFilename: "docs/assets/css/src/docs.css.map",
|
|
|
|
sourceMapURL: "docs.css.map"
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"docs/assets/css/src/docs.css": "docs/assets/css/src/docs.less",
|
|
|
|
}
|
2014-11-26 15:28:22 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-12-04 15:17:45 +03:00
|
|
|
// Autoprefix .css and edit its source map
|
|
|
|
// Autoprefix .min.css an edit its source map
|
2014-11-26 15:28:22 +03:00
|
|
|
autoprefixer: {
|
|
|
|
options: {
|
2014-12-04 15:17:45 +03:00
|
|
|
map: true,
|
2015-11-20 23:24:39 +03:00
|
|
|
browsers: configBridge.config.autoprefixerBrowsers
|
2014-11-26 15:28:22 +03:00
|
|
|
},
|
2014-12-04 15:17:45 +03:00
|
|
|
material: {
|
2014-11-26 15:28:22 +03:00
|
|
|
files: {
|
2015-11-22 19:23:34 +03:00
|
|
|
"dist/css/bootstrap-material-design.css": "dist/css/bootstrap-material-design.css"
|
2015-03-09 19:10:44 +03:00
|
|
|
}
|
|
|
|
},
|
2014-12-04 15:17:45 +03:00
|
|
|
ripples: {
|
2014-11-26 15:28:22 +03:00
|
|
|
files: {
|
2015-11-20 21:21:02 +03:00
|
|
|
"dist/css/ripples.css": "dist/css/ripples.css"
|
2014-11-26 15:28:22 +03:00
|
|
|
}
|
2015-11-20 23:24:39 +03:00
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
src: ['docs/assets/css/src/docs.css']
|
|
|
|
},
|
|
|
|
examples: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'docs/examples/',
|
|
|
|
src: ['**/*.css'],
|
|
|
|
dest: 'docs/examples/'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
csslint: {
|
|
|
|
options: {
|
|
|
|
csslintrc: 'less/.csslintrc'
|
|
|
|
},
|
|
|
|
dist: [
|
2015-11-22 19:23:34 +03:00
|
|
|
'dist/css/bootstrap-material-design.css',
|
|
|
|
'dist/css/ripples.css',
|
|
|
|
],
|
|
|
|
distmin: [
|
|
|
|
'dist/css/bootstrap-material-design.min.css',
|
|
|
|
'dist/css/ripples.min.css',
|
2015-11-20 23:24:39 +03:00
|
|
|
],
|
|
|
|
examples: [
|
|
|
|
'docs/examples/**/*.css'
|
|
|
|
],
|
|
|
|
docs: {
|
|
|
|
options: {
|
|
|
|
ids: false,
|
|
|
|
'overqualified-elements': false
|
|
|
|
},
|
|
|
|
src: 'docs/assets/css/src/docs.css'
|
2014-11-26 15:28:22 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-12-04 15:30:23 +03:00
|
|
|
// Minify CSS and adapt maps
|
2015-11-20 21:21:02 +03:00
|
|
|
cssmin: {
|
|
|
|
options: {
|
|
|
|
// TODO: disable `zeroUnits` optimization once clean-css 3.2 is released
|
|
|
|
// and then simplify the fix for https://github.com/twbs/bootstrap/issues/14837 accordingly
|
|
|
|
compatibility: 'ie8',
|
|
|
|
keepSpecialComments: '*',
|
|
|
|
sourceMap: true,
|
|
|
|
advanced: false
|
|
|
|
},
|
2014-12-04 15:30:23 +03:00
|
|
|
material: {
|
2015-11-22 19:23:34 +03:00
|
|
|
src: "dist/css/bootstrap-material-design.css",
|
|
|
|
dest: "dist/css/bootstrap-material-design.min.css"
|
2015-03-09 19:10:44 +03:00
|
|
|
},
|
2014-12-04 15:30:23 +03:00
|
|
|
ripples: {
|
|
|
|
src: "dist/css/ripples.css",
|
|
|
|
dest: "dist/css/ripples.min.css"
|
2015-11-20 21:21:02 +03:00
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
src: [
|
|
|
|
'docs/assets/css/ie10-viewport-bug-workaround.css',
|
|
|
|
'docs/assets/css/src/pygments-manni.css',
|
|
|
|
'docs/assets/css/src/docs.css'
|
|
|
|
],
|
|
|
|
dest: 'docs/assets/css/docs.min.css'
|
2014-12-04 15:30:23 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-12-04 15:17:45 +03:00
|
|
|
// Copy .js to dist/js/ folder
|
2014-11-26 15:28:22 +03:00
|
|
|
copy: {
|
2014-12-04 15:17:45 +03:00
|
|
|
material: {
|
|
|
|
src: "scripts/material.js",
|
|
|
|
dest: "dist/js/material.js"
|
|
|
|
},
|
|
|
|
ripples: {
|
|
|
|
src: "scripts/ripples.js",
|
|
|
|
dest: "dist/js/ripples.js"
|
2014-11-26 15:28:22 +03:00
|
|
|
},
|
2014-12-04 15:17:45 +03:00
|
|
|
fonts: {
|
2014-11-26 15:28:22 +03:00
|
|
|
expand: true,
|
|
|
|
cwd: "fonts/",
|
|
|
|
src: "**",
|
|
|
|
dest: "dist/fonts/",
|
|
|
|
flatten: true,
|
|
|
|
filter: "isFile"
|
2015-11-20 23:24:39 +03:00
|
|
|
},
|
|
|
|
docs: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'dist/',
|
|
|
|
src: [
|
|
|
|
'**/*'
|
|
|
|
],
|
|
|
|
dest: 'docs/dist/'
|
2014-11-26 15:28:22 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-12-04 15:17:45 +03:00
|
|
|
// Compile .js to .min.js
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
sourceMap: true
|
|
|
|
},
|
|
|
|
material: {
|
|
|
|
files: {
|
|
|
|
"dist/js/material.min.js": "dist/js/material.js"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ripples: {
|
|
|
|
files: {
|
|
|
|
"dist/js/ripples.min.js": "dist/js/ripples.js"
|
|
|
|
}
|
2015-11-20 23:24:39 +03:00
|
|
|
},
|
|
|
|
customize: {
|
|
|
|
src: configBridge.paths.customizerJs,
|
|
|
|
dest: 'docs/assets/js/customize.min.js'
|
|
|
|
},
|
|
|
|
docsJs: {
|
|
|
|
src: configBridge.paths.docsJs,
|
|
|
|
dest: 'docs/assets/js/docs.min.js'
|
2014-12-04 15:17:45 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-12-05 11:25:06 +03: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: "."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2014-11-26 15:28:22 +03:00
|
|
|
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: {
|
2015-11-20 23:24:39 +03:00
|
|
|
jshintrc: "scripts/.jshintrc",
|
2014-11-26 15:28:22 +03:00
|
|
|
reporter: require("jshint-stylish")
|
|
|
|
},
|
2015-11-20 23:24:39 +03:00
|
|
|
grunt: {
|
|
|
|
options: {
|
|
|
|
jshintrc: 'grunt/.jshintrc'
|
|
|
|
},
|
|
|
|
src: ['Gruntfile.js', 'package.js']
|
|
|
|
},
|
2015-11-21 19:37:35 +03:00
|
|
|
core: {
|
|
|
|
src: ["scripts/**/*.js"]
|
|
|
|
},
|
2014-11-26 15:28:22 +03:00
|
|
|
test: {
|
2015-11-20 23:24:39 +03:00
|
|
|
src: ["test/**/*.js"]
|
|
|
|
},
|
|
|
|
assets: {
|
2014-11-26 15:28:22 +03:00
|
|
|
options: {
|
2015-11-20 23:24:39 +03:00
|
|
|
jshintrc: "docs/assets/js/.jshintrc"
|
|
|
|
},
|
|
|
|
src: ['docs/assets/js/src/*.js', 'docs/assets/js/*.js', '!docs/assets/js/*.min.js']
|
2014-11-26 15:28:22 +03:00
|
|
|
}
|
|
|
|
},
|
2015-11-20 23:24:39 +03:00
|
|
|
|
|
|
|
jscs: {
|
|
|
|
options: {
|
|
|
|
config: 'scripts/.jscsrc'
|
|
|
|
},
|
|
|
|
grunt: {
|
|
|
|
src: '<%= jshint.grunt.src %>'
|
|
|
|
},
|
|
|
|
core: {
|
|
|
|
src: '<%= jshint.core.src %>'
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
src: '<%= jshint.test.src %>'
|
|
|
|
},
|
|
|
|
assets: {
|
|
|
|
options: {
|
|
|
|
requireCamelCaseOrUpperCaseIdentifiers: null
|
|
|
|
},
|
|
|
|
src: '<%= jshint.assets.src %>'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-11-26 15:28:22 +03:00
|
|
|
watch: {
|
2015-11-07 02:41:39 +03:00
|
|
|
html: {
|
2015-11-10 23:31:56 +03:00
|
|
|
files: ["index.html", "bootstrap-elements.html", "test.html"],
|
2015-11-07 02:41:39 +03:00
|
|
|
tasks: ["htmllint", "bootlint"]
|
|
|
|
},
|
2015-11-21 19:37:35 +03:00
|
|
|
//src: {
|
|
|
|
// files: '<%= jshint.core.src %>',
|
|
|
|
// tasks: ['jshint:core', 'dist-js'] // add tests when working again
|
|
|
|
//},
|
2015-11-20 23:24:39 +03:00
|
|
|
test: {
|
2014-11-26 15:28:22 +03:00
|
|
|
files: ["test/**/*.js"],
|
2015-11-20 23:24:39 +03:00
|
|
|
tasks: ["jshint:test", "jasmine"]
|
2014-11-26 15:28:22 +03:00
|
|
|
},
|
|
|
|
less: {
|
2015-11-04 23:49:03 +03:00
|
|
|
files: ["less/**/*.less"],
|
2015-11-20 23:24:39 +03:00
|
|
|
tasks: ["dist-less"]
|
2014-11-26 15:28:22 +03:00
|
|
|
},
|
|
|
|
livereload: {
|
|
|
|
options: {
|
|
|
|
livereload: "<%= connect.options.livereload %>"
|
|
|
|
},
|
|
|
|
files: [
|
|
|
|
"index.html",
|
2015-11-07 02:41:39 +03:00
|
|
|
"bootstrap-elements.html",
|
2015-11-06 19:41:56 +03:00
|
|
|
"dist/js/**/*.js",
|
2014-11-26 15:28:22 +03:00
|
|
|
"dist/css/**/*.css",
|
2015-03-04 23:47:53 +03:00
|
|
|
"demo/**/*.{png,jpg,jpeg,gif,webp,svg}"
|
2014-11-26 15:28:22 +03:00
|
|
|
]
|
|
|
|
}
|
2014-12-15 18:16:33 +03:00
|
|
|
},
|
2015-11-21 00:17:08 +03:00
|
|
|
|
|
|
|
compress: {
|
|
|
|
main: {
|
|
|
|
options: {
|
|
|
|
archive: 'bootstrap-material-design-<%= pkg.version %>-dist.zip',
|
|
|
|
mode: 'zip',
|
|
|
|
level: 9,
|
|
|
|
pretty: true
|
|
|
|
},
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'dist/',
|
|
|
|
src: ['**'],
|
|
|
|
dest: 'bootstrap-material-design-<%= pkg.version %>-dist'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-12-15 18:16:33 +03:00
|
|
|
exec: {
|
|
|
|
"meteor-init": {
|
|
|
|
command: [
|
|
|
|
// Make sure Meteor is installed, per https://meteor.com/install.
|
|
|
|
// The curl'ed script is safe; takes 2 minutes to read source & check.
|
|
|
|
"type meteor >/dev/null 2>&1 || { curl https://install.meteor.com/ | sh; }",
|
|
|
|
// Meteor expects package.js to be in the root directory of
|
|
|
|
// the checkout, so copy it there temporarily
|
|
|
|
"cp meteor/package.js ."
|
|
|
|
].join(";")
|
|
|
|
},
|
|
|
|
"meteor-cleanup": {
|
|
|
|
// remove build files and package.js
|
|
|
|
command: "rm -rf .build.* versions.json package.js"
|
|
|
|
},
|
|
|
|
"meteor-test": {
|
|
|
|
command: "node_modules/.bin/spacejam --mongo-url mongodb:// test-packages ./"
|
|
|
|
},
|
|
|
|
"meteor-publish": {
|
2014-12-16 05:09:20 +03:00
|
|
|
command: [
|
|
|
|
"ALL_EXIT_CODE=0; for PACKAGE_FILE in meteor/package*.js",
|
2015-11-04 23:49:03 +03:00
|
|
|
"do cp $PACKAGE_FILE ./package.js && meteor publish $@",
|
|
|
|
"ALL_EXIT_CODE=$(echo $ALL_EXIT_CODE + $? | bc); done",
|
2014-12-16 05:09:20 +03:00
|
|
|
"exit $ALL_EXIT_CODE"
|
|
|
|
].join(";")
|
2014-12-15 18:16:33 +03:00
|
|
|
}
|
2014-11-26 15:28:22 +03:00
|
|
|
}
|
2014-12-15 18:16:33 +03:00
|
|
|
|
2014-11-26 15:28:22 +03:00
|
|
|
});
|
|
|
|
|
2015-11-20 00:58:21 +03:00
|
|
|
|
2015-11-20 21:21:02 +03:00
|
|
|
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
|
2015-11-20 00:58:21 +03:00
|
|
|
//require('time-grunt')(grunt);
|
|
|
|
|
2015-11-20 23:24:39 +03:00
|
|
|
grunt.registerTask('test-js', ['jshint:core', 'jshint:test', 'jshint:grunt', 'jscs:core', 'jscs:test', 'jscs:grunt', 'qunit']);
|
|
|
|
grunt.registerTask("test", [
|
|
|
|
"dist",
|
|
|
|
"jasmine:scripts:build",
|
|
|
|
"connect:test:keepalive"
|
|
|
|
]);
|
|
|
|
|
2015-11-20 00:58:21 +03:00
|
|
|
// Docs HTML validation task
|
|
|
|
grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint']);
|
|
|
|
|
2015-11-05 17:11:38 +03:00
|
|
|
grunt.loadNpmTasks("grunt-less-to-sass");
|
2015-11-02 23:39:13 +03:00
|
|
|
|
2015-11-20 21:21:02 +03:00
|
|
|
// CSS distribution tasks
|
|
|
|
grunt.registerTask("dist-sass", [
|
2015-11-03 02:55:59 +03:00
|
|
|
"lessToSass:convert",
|
|
|
|
"sass:compile"
|
2015-11-02 22:42:29 +03:00
|
|
|
]);
|
|
|
|
|
2015-11-20 21:21:02 +03:00
|
|
|
grunt.registerTask('less-compile', [
|
2014-12-04 15:17:45 +03:00
|
|
|
"less:material",
|
2015-11-20 21:21:02 +03:00
|
|
|
"less:ripples"
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask("dist-less", [
|
|
|
|
"less-compile",
|
|
|
|
|
2014-12-04 15:17:45 +03:00
|
|
|
"autoprefixer:material",
|
2015-11-20 21:21:02 +03:00
|
|
|
"autoprefixer:ripples",
|
2015-11-22 19:23:34 +03:00
|
|
|
//"csslint:dist",
|
2015-11-20 21:21:02 +03:00
|
|
|
"cssmin:material",
|
2015-11-22 19:23:34 +03:00
|
|
|
"cssmin:ripples",
|
|
|
|
//"csslint:distmin"
|
2014-12-04 15:17:45 +03:00
|
|
|
]);
|
2015-11-20 21:21:02 +03:00
|
|
|
|
|
|
|
grunt.registerTask("dist-js", [
|
2015-11-20 23:24:39 +03:00
|
|
|
"jshint",
|
2014-12-04 15:17:45 +03:00
|
|
|
"copy:material",
|
2015-11-20 21:21:02 +03:00
|
|
|
"uglify:material",
|
|
|
|
"copy:ripples",
|
|
|
|
"uglify:ripples"
|
2014-12-04 15:17:45 +03:00
|
|
|
]);
|
2015-11-20 21:21:02 +03:00
|
|
|
|
|
|
|
grunt.registerTask("dist-fonts", [
|
2015-11-19 00:51:06 +03:00
|
|
|
"copy:fonts"
|
|
|
|
]);
|
2014-12-04 15:17:45 +03:00
|
|
|
|
2015-11-20 21:21:02 +03:00
|
|
|
// Full distribution
|
|
|
|
grunt.registerTask("dist", [
|
|
|
|
"clean:dist",
|
|
|
|
|
|
|
|
"htmllint",
|
|
|
|
"bootlint",
|
|
|
|
|
|
|
|
"dist-less",
|
|
|
|
"dist-js",
|
|
|
|
"dist-fonts",
|
|
|
|
"dist-sass"
|
2014-12-04 15:17:45 +03:00
|
|
|
]);
|
2014-11-26 15:28:22 +03:00
|
|
|
|
2015-11-20 21:21:02 +03:00
|
|
|
// Default task.
|
2015-11-20 23:24:39 +03:00
|
|
|
grunt.registerTask('default', ['dist']); // test as well when it works?
|
2015-11-20 21:21:02 +03:00
|
|
|
|
2014-11-26 15:28:22 +03:00
|
|
|
|
2015-11-20 21:21:02 +03:00
|
|
|
grunt.registerTask("serve", [
|
|
|
|
"htmllint",
|
|
|
|
"bootlint",
|
|
|
|
"dist-less",
|
|
|
|
"dist-js",
|
|
|
|
"dist-fonts",
|
|
|
|
"connect:livereload",
|
|
|
|
"watch"
|
|
|
|
]);
|
2014-10-03 23:15:31 +04:00
|
|
|
|
2014-12-15 18:16:33 +03:00
|
|
|
// Meteor tasks
|
|
|
|
grunt.registerTask("meteor-test", ["exec:meteor-init", "exec:meteor-test", "exec:meteor-cleanup"]);
|
|
|
|
grunt.registerTask("meteor-publish", ["exec:meteor-init", "exec:meteor-publish", "exec:meteor-cleanup"]);
|
|
|
|
grunt.registerTask("meteor", ["exec:meteor-init", "exec:meteor-test", "exec:meteor-publish", "exec:meteor-cleanup"]);
|
|
|
|
|
2015-11-20 23:24:39 +03:00
|
|
|
|
|
|
|
// Docs task.
|
|
|
|
grunt.registerTask('build-icons-data', function () { generateIconsData.call(this, grunt); });
|
2015-11-21 01:18:58 +03:00
|
|
|
grunt.registerTask('docs-css', ['less:docs','autoprefixer:docs', 'autoprefixer:examples', 'cssmin:docs']);
|
2015-11-20 23:24:39 +03:00
|
|
|
grunt.registerTask('lint-docs-css', ['csslint:docs', 'csslint:examples']);
|
|
|
|
grunt.registerTask('docs-js', ['uglify:docsJs', 'uglify:customize']);
|
|
|
|
grunt.registerTask('lint-docs-js', ['jshint:assets', 'jscs:assets']);
|
|
|
|
grunt.registerTask('docs', [
|
|
|
|
'docs-css', 'lint-docs-css', 'docs-js', 'lint-docs-js', 'clean:docs', 'copy:docs', 'build-icons-data'
|
|
|
|
]);
|
|
|
|
|
2015-11-21 00:17:08 +03:00
|
|
|
grunt.registerTask('prep-release', ['dist', 'docs', 'jekyll:github', 'htmlmin']); //, 'compress']);
|
2014-10-02 13:36:05 +04:00
|
|
|
};
|