2014-08-27 02:01:42 +04:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
// Full list of files that must be included by RequireJS
|
2014-10-15 05:12:57 +04:00
|
|
|
includes = [
|
|
|
|
'jquery.select2'
|
|
|
|
];
|
2014-08-27 02:01:42 +04:00
|
|
|
|
2014-10-15 05:12:57 +04:00
|
|
|
amdIncludes = [
|
|
|
|
'almond'
|
|
|
|
];
|
|
|
|
|
|
|
|
fullIncludes = [
|
|
|
|
'jquery'
|
|
|
|
].concat(includes);
|
2014-08-27 02:01:42 +04:00
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
uglify: {
|
2014-10-15 05:12:57 +04:00
|
|
|
'dist': {
|
2014-08-27 02:01:42 +04:00
|
|
|
src: 'dist/js/select2.js',
|
|
|
|
dest: 'dist/js/select2.min.js'
|
|
|
|
},
|
2014-10-15 05:12:57 +04:00
|
|
|
'dist.full': {
|
2014-08-27 02:01:42 +04:00
|
|
|
src: 'dist/js/select2.full.js',
|
|
|
|
dest: 'dist/js/select2.full.min.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
qunit: {
|
|
|
|
all: [
|
2014-10-15 05:12:57 +04:00
|
|
|
'tests/**/*.html'
|
2014-08-27 02:01:42 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2014-09-21 23:21:43 +04:00
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
jshintrc: true
|
|
|
|
},
|
|
|
|
code: {
|
|
|
|
src: ["src/js/**/*.js"]
|
|
|
|
},
|
|
|
|
tests: {
|
|
|
|
src: ["tests/**/*.js"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-08-27 02:01:42 +04:00
|
|
|
sass: {
|
|
|
|
dist: {
|
|
|
|
options: {
|
|
|
|
outputStyle: "compressed"
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"dist/css/select2.min.css": [
|
|
|
|
"src/scss/core.scss",
|
|
|
|
"src/scss/theme/default/layout.css"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
outputStyle: "nested"
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"dist/css/select2.css": [
|
|
|
|
"src/scss/core.scss",
|
|
|
|
"src/scss/theme/default/layout.css"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
requirejs: {
|
|
|
|
"dist": {
|
|
|
|
options: {
|
|
|
|
baseUrl: "src/js",
|
|
|
|
optimize: "none",
|
|
|
|
name: "select2/core",
|
|
|
|
out: "dist/js/select2.js",
|
2014-10-15 05:12:57 +04:00
|
|
|
include: amdIncludes.concat(includes),
|
2014-08-27 02:01:42 +04:00
|
|
|
paths: {
|
|
|
|
almond: "../../vendor/almond-0.2.9",
|
|
|
|
jquery: "jquery.shim"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"dist.full": {
|
|
|
|
options: {
|
|
|
|
baseUrl: "src/js",
|
|
|
|
optimize: "none",
|
|
|
|
name: "select2/core",
|
|
|
|
out: "dist/js/select2.full.js",
|
2014-10-15 05:12:57 +04:00
|
|
|
include: amdIncludes.concat(fullIncludes),
|
2014-08-27 02:01:42 +04:00
|
|
|
paths: {
|
|
|
|
almond: "../../vendor/almond-0.2.9",
|
|
|
|
jquery: "../../vendor/jquery-2.1.0"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"amd": {
|
|
|
|
options: {
|
|
|
|
baseUrl: "src/js",
|
|
|
|
optimize: "none",
|
|
|
|
name: "select2/core",
|
|
|
|
out: "dist/js/select2.amd.js",
|
|
|
|
paths: {
|
|
|
|
jquery: "empty:"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"amd.full": {
|
|
|
|
options: {
|
|
|
|
baseUrl: "src/js",
|
|
|
|
optimize: "none",
|
|
|
|
name: "select2/core",
|
|
|
|
out: "dist/js/select2.amd.full.js",
|
2014-10-15 05:12:57 +04:00
|
|
|
include: fullIncludes,
|
2014-08-27 02:01:42 +04:00
|
|
|
paths: {
|
|
|
|
jquery: "empty:"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
concat: {
|
|
|
|
"dist": {
|
|
|
|
src: [
|
2014-10-15 05:12:57 +04:00
|
|
|
"src/js/start.js",
|
2014-08-27 02:01:42 +04:00
|
|
|
"dist/js/select2.js",
|
2014-10-15 05:12:57 +04:00
|
|
|
"src/js/end.js"
|
2014-08-27 02:01:42 +04:00
|
|
|
],
|
|
|
|
dest: "dist/js/select2.js"
|
|
|
|
},
|
|
|
|
"dist.full": {
|
|
|
|
src: [
|
2014-10-15 05:12:57 +04:00
|
|
|
"src/js/start.js",
|
2014-08-27 02:01:42 +04:00
|
|
|
"dist/js/select2.full.js",
|
2014-10-15 05:12:57 +04:00
|
|
|
"src/js/end.js"
|
2014-08-27 02:01:42 +04:00
|
|
|
],
|
|
|
|
dest: "dist/js/select2.full.js"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
js: {
|
|
|
|
files: [
|
2014-08-29 03:54:01 +04:00
|
|
|
"src/js/select2/**/*.js",
|
|
|
|
"tests/**/*.js",
|
2014-08-27 02:01:42 +04:00
|
|
|
],
|
|
|
|
tasks: [
|
|
|
|
"compile",
|
2014-10-11 06:17:51 +04:00
|
|
|
"test",
|
|
|
|
'minify'
|
2014-08-27 02:01:42 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
files: [
|
|
|
|
"src/scss/**/*.scss"
|
|
|
|
],
|
|
|
|
tasks: [
|
2014-10-11 06:17:51 +04:00
|
|
|
"compile",
|
|
|
|
'minify'
|
2014-08-27 02:01:42 +04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-concat")
|
2014-09-21 23:21:43 +04:00
|
|
|
grunt.loadNpmTasks("grunt-contrib-jshint")
|
2014-08-27 02:01:42 +04:00
|
|
|
grunt.loadNpmTasks("grunt-contrib-qunit")
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-requirejs")
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-uglify")
|
|
|
|
grunt.loadNpmTasks("grunt-contrib-watch")
|
|
|
|
|
|
|
|
grunt.loadNpmTasks("grunt-sass")
|
|
|
|
|
|
|
|
grunt.registerTask("default", ["compile", "test", "minify"])
|
|
|
|
|
|
|
|
grunt.registerTask("compile", ["requirejs", "sass:dev", "concat"])
|
|
|
|
grunt.registerTask("minify", ["uglify", "sass:dist"])
|
2014-09-21 23:21:43 +04:00
|
|
|
grunt.registerTask("test", ["qunit", "jshint"])
|
2014-08-27 02:01:42 +04:00
|
|
|
}
|