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: {
|
2014-11-01 02:10:38 +03:00
|
|
|
src: ['src/js/**/*.js']
|
2014-09-21 23:21:43 +04:00
|
|
|
},
|
|
|
|
tests: {
|
2014-11-01 02:10:38 +03:00
|
|
|
src: ['tests/**/*.js']
|
2014-09-21 23:21:43 +04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-08-27 02:01:42 +04:00
|
|
|
sass: {
|
|
|
|
dist: {
|
|
|
|
options: {
|
2014-11-01 02:10:38 +03:00
|
|
|
outputStyle: 'compressed'
|
2014-08-27 02:01:42 +04:00
|
|
|
},
|
|
|
|
files: {
|
2014-11-01 02:10:38 +03:00
|
|
|
'dist/css/select2.min.css': [
|
|
|
|
'src/scss/core.scss',
|
|
|
|
'src/scss/theme/default/layout.css'
|
2014-08-27 02:01:42 +04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dev: {
|
|
|
|
options: {
|
2014-11-01 02:10:38 +03:00
|
|
|
outputStyle: 'nested'
|
2014-08-27 02:01:42 +04:00
|
|
|
},
|
|
|
|
files: {
|
2014-11-01 02:10:38 +03:00
|
|
|
'dist/css/select2.css': [
|
|
|
|
'src/scss/core.scss',
|
|
|
|
'src/scss/theme/default/layout.css'
|
2014-08-27 02:01:42 +04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
requirejs: {
|
2014-11-01 02:10:38 +03:00
|
|
|
'dist': {
|
2014-08-27 02:01:42 +04:00
|
|
|
options: {
|
2014-11-01 02:10:38 +03:00
|
|
|
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: {
|
2014-11-01 02:10:38 +03:00
|
|
|
almond: '../../vendor/almond-0.2.9',
|
|
|
|
jquery: 'jquery.shim'
|
2014-11-01 03:15:17 +03:00
|
|
|
},
|
|
|
|
wrap: grunt.file.readJSON('src/js/banner.json')
|
2014-08-27 02:01:42 +04:00
|
|
|
}
|
|
|
|
},
|
2014-11-01 02:10:38 +03:00
|
|
|
'dist.full': {
|
2014-08-27 02:01:42 +04:00
|
|
|
options: {
|
2014-11-01 02:10:38 +03:00
|
|
|
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: {
|
2014-11-01 02:10:38 +03:00
|
|
|
almond: '../../vendor/almond-0.2.9',
|
|
|
|
jquery: '../../vendor/jquery-2.1.0'
|
2014-11-01 03:15:17 +03:00
|
|
|
},
|
|
|
|
wrap: grunt.file.readJSON('src/js/banner.json')
|
2014-08-27 02:01:42 +04:00
|
|
|
}
|
|
|
|
},
|
2014-11-01 02:10:38 +03:00
|
|
|
'amd': {
|
2014-08-27 02:01:42 +04:00
|
|
|
options: {
|
2014-11-01 02:10:38 +03:00
|
|
|
baseUrl: 'src/js',
|
|
|
|
optimize: 'none',
|
|
|
|
name: 'select2/core',
|
|
|
|
out: 'dist/js/select2.amd.js',
|
2014-10-16 03:26:38 +04:00
|
|
|
include: includes,
|
2014-08-27 02:01:42 +04:00
|
|
|
paths: {
|
2014-11-01 02:10:38 +03:00
|
|
|
jquery: 'empty:'
|
2014-11-01 03:15:17 +03:00
|
|
|
},
|
|
|
|
wrap: grunt.file.readJSON('src/js/banner.json')
|
2014-08-27 02:01:42 +04:00
|
|
|
}
|
|
|
|
},
|
2014-11-01 02:10:38 +03:00
|
|
|
'amd.full': {
|
2014-08-27 02:01:42 +04:00
|
|
|
options: {
|
2014-11-01 02:10:38 +03:00
|
|
|
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: {
|
2014-11-01 02:10:38 +03:00
|
|
|
jquery: 'empty:'
|
2014-11-01 03:15:17 +03:00
|
|
|
},
|
|
|
|
wrap: grunt.file.readJSON('src/js/banner.json')
|
2014-08-27 02:01:42 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
js: {
|
|
|
|
files: [
|
2014-11-01 02:10:38 +03:00
|
|
|
'src/js/select2/**/*.js',
|
|
|
|
'tests/**/*.js'
|
2014-08-27 02:01:42 +04:00
|
|
|
],
|
|
|
|
tasks: [
|
2014-11-01 02:10:38 +03:00
|
|
|
'compile',
|
|
|
|
'test',
|
2014-10-11 06:17:51 +04:00
|
|
|
'minify'
|
2014-08-27 02:01:42 +04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
files: [
|
2014-11-01 02:10:38 +03:00
|
|
|
'src/scss/**/*.scss'
|
2014-08-27 02:01:42 +04:00
|
|
|
],
|
|
|
|
tasks: [
|
2014-11-01 02:10:38 +03:00
|
|
|
'compile',
|
2014-10-11 06:17:51 +04:00
|
|
|
'minify'
|
2014-08-27 02:01:42 +04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-11-01 02:10:38 +03:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
2014-08-27 02:01:42 +04:00
|
|
|
|
2014-11-01 02:10:38 +03:00
|
|
|
grunt.loadNpmTasks('grunt-sass');
|
2014-08-27 02:01:42 +04:00
|
|
|
|
2014-11-01 02:10:38 +03:00
|
|
|
grunt.registerTask('default', ['compile', 'test', 'minify']);
|
2014-08-27 02:01:42 +04:00
|
|
|
|
2014-11-01 03:15:17 +03:00
|
|
|
grunt.registerTask('compile', ['requirejs', 'sass:dev']);
|
2014-11-01 02:10:38 +03:00
|
|
|
grunt.registerTask('minify', ['uglify', 'sass:dist']);
|
|
|
|
grunt.registerTask('test', ['qunit', 'jshint']);
|
|
|
|
};
|