module.exports = function (grunt) {
// Project configuration.
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
project: {
src: '.',
html: ['<%= project.src %>/../../templates/base.plim']
},
source: './source/',
build: './build/script/',
app: {
src: '<%= source %>class/',
dest: '<%= source %>script/'
},
theme: {
src: '<%= source %>resource/theme/js/',
dest: '<%= source %>script/'
},
concat: {
options: {
separator: ';\n'
},
app: {
src: [ '<%= app.src %>app/Application.js',
'<%= app.src %>app/classifiers.js',
'<%= app.src %>../models/Resources.js',
'<%= app.src %>../models/*.js' ,
'<%= app.src %>../models/**/*.js' ],
dest: '<%= app.dest %>app.js'
},
theme: {
src : [
'<%= theme.src %>plugins/jquery/jquery-ui-1.14.4.custom.min.js',
//'<%= theme.src %>plugins/jquery/jquery-migrate-1.1.1.min.js',
'<%= theme.src %>plugins/jquery/globalize.js',
'<%= theme.src %>plugins/other/excanvas.js',
'<%= theme.src %>plugins/other/jquery.mousewheel.min.js',
'<%= theme.src %>plugins/bootstrap/bootstrap.min.js',
'<%= theme.src %>plugins/cookies/jquery.cookies.2.2.0.min.js',
'<%= theme.src %>plugins/pnotify/jquery.pnotify.min.js',
'<%= theme.src %>plugins/datatables/jquery.dataTables.js',
'<%= theme.src %>plugins/fileupload/js/tmpl.js',
'<%= theme.src %>plugins/fileupload/js/load-image.all.min.js',
'<%= theme.src %>plugins/canvas2blob/js/canvas-to-blob.js',
'<%= theme.src %>plugins/blueimp/js/jquery.blueimp-gallery.min.js',
'<%= theme.src %>plugins/fileupload/js/jquery.iframe-transport.js',
'<%= theme.src %>plugins/fileupload/js/jquery.fileupload.js',
'<%= theme.src %>plugins/fileupload/js/jquery.fileupload-process.js',
'<%= theme.src %>plugins/fileupload/js/jquery.fileupload-image.js',
'<%= theme.src %>plugins/fileupload/js/jquery.fileupload-audio.js',
'<%= theme.src %>plugins/fileupload/js/jquery.fileupload-video.js',
'<%= theme.src %>plugins/fileupload/js/jquery.fileupload-validate.js',
'<%= theme.src %>plugins/fileupload/js/jquery.fileupload-ui.js',
'<%= theme.src %>plugins/multiselect/jquery.multi-select.min.js',
'<%= theme.src %>plugins/jstree/jstree.min.js',
'<%= theme.src %>plugins/animatedprogressbar/animated_progressbar.js',
'<%= theme.src %>plugins/cron/jquery-cron.js',
'<%= theme.src %>plugins/select/select2.min.js',
'<%= theme.src %>plugins/select/i18n/ru.js',
//'<%= theme.src %>plugins/plupload/plupload.js',
//'<%= theme.src %>plugins/plupload/plupload.gears.js',
//'<%= theme.src %>plugins/plupload/plupload.silverligh,t.js',
//'<%= theme.src %>plugins/plupload/plupload.flash.js',
//'<%= theme.src %>plugins/plupload/plupload.browserplus.js',
//'<%= theme.src %>plugins/plupload/plupload.html4.js',
//'<%= theme.src %>plugins/plupload/plupload.html5.js',
//'<%= theme.src %>plugins/plupload/i18n/ru.js',
//'<%= theme.src %>plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js',
],
dest: '<%= theme.dest %>theme.js'
}
},
qunit: {
files: ['test/**/*.html']
},
jshint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true
},
force: true
},
//all: ['<%= app.src %>*.js']
beforeconcat: [
'<%= app.src %>*.js'
],
afterconcat: [
//'<%= application.dest %>app.js',
//'<%= libs.dest %>libs.js'
//'<%= theme.dest %>theme.js'
]
},
uglify: {
options: {},
app: {
files: {'<%= build %>app.js': ['<%= concat.app.dest %>']}
},
theme: {
files: {'<%= build %>theme.js': ['<%= concat.theme.dest %>']}
}
},
removelogging: {
dist: {
src: "<%= app.dest %>app.min.js",
dest: "<%= app.dest %>app.min.js",
options: {}
}
},
yaml: {
your_target: {
options: {
ignored: /^_/,
space: 4,
constructors: {
'!include': function (node, yaml) {
var data = grunt.file.read(node.value, 'utf-8');
return yaml.load(data);
}
}
},
files: [
{
expand: true,
cwd: './source/class/',
src: ['**/*.yml'],
dest: './source/class/'
}
]
}
},
less: {
options: {},
files: {
expand: true,
src: ['./source/class/**/*.less', './source/resource/theme/**/*.less'],
ext: '.css'
}
},
bower: {
install: {
options: {
targetDir: '<%= project.assets %>bower_components',
layout: 'byType',
install: true,
verbose: false,
cleanTargetDir: false,
cleanBowerDir: false,
bowerOptions: {}
}
}
},
bowerInstall: {
target: {
src: [
'<%= project.html %>'
],
fileTypes: {
html: {
replace: {
js: 'script src="${request.static_url(\'uris:static/{{filePath}}\')}"',
css: 'link(href="${request.static_url(\'uris:static/{{filePath}}\')}" media="all" rel="stylesheet" type="text/css")'
}
}
},
cwd: '',
dependencies: true,
devDependencies: false,
exclude: [],
ignorePath: '../static/',
overrides: {}
}
},
watch: {
options: {
livereload: true
},
app: {
options: {
livereload: true
},
files: ['<%= concat.app.src %>'],
tasks: [ 'concat:app' ]
},
theme: {
files: ['<%= concat.theme.src %>'],
tasks: ['concat:theme']
},
pagelets: {
options: {
livereload: true
},
files: [
'./source/class/**/*.html',
'./source/class/**/*.css',
'./source/class/**/*.js',
'./source/class/**/*.json'
]
},
yaml: {
options: {
livereload: true
},
files: [
'./source/class/**/*.yml'
],
tasks: ['newer:yaml']
},
less: {
files: [
'./source/class/**/*.less',
'./source/resource/theme/**/*.less'
],
tasks: ['newer:less']
}
}
});
grunt.loadNpmTasks('grunt-bower-install');
grunt.loadNpmTasks('grunt-bower-installer');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-remove-logging');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-newer');
grunt.loadNpmTasks('grunt-yaml');
grunt.registerTask('default',
[
//'bower:install',
//'bowerInstall',
'jshint',
'concat',
'newer:yaml',
'newer:less',
'watch'
]
);
grunt.registerTask('build',
[
//'bower:install',
//'bowerInstall',
'jshint',
'concat',
'yaml',
'uglify',
'removelogging'
]
);
// grunt --verbose --debug --stack
};