2016-03-08 16:02:34 +00:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
appDir: 'app/Resources/static',
|
2016-10-03 21:08:26 +00:00
|
|
|
buildDir: 'app/Resources/build',
|
2016-09-29 07:18:46 +00:00
|
|
|
modulesDir: 'node_modules',
|
2016-10-03 21:08:26 +00:00
|
|
|
releaseDir: 'web/bundles/wallabagcore',
|
2016-03-08 16:02:34 +00:00
|
|
|
|
|
|
|
postcss: {
|
|
|
|
material: {
|
|
|
|
options: {
|
|
|
|
map: {
|
2016-06-09 17:02:38 +00:00
|
|
|
inline: false,
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
processors: [
|
|
|
|
require('pixrem')(),
|
2016-06-09 17:02:38 +00:00
|
|
|
require('autoprefixer')({ browsers: 'last 2 versions' }),
|
|
|
|
require('cssnano')(),
|
|
|
|
],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
src: '<%= buildDir %>/material.css',
|
2016-10-03 21:08:26 +00:00
|
|
|
dest: '<%= releaseDir %>/themes/material/css/style.min.css',
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
baggy: {
|
|
|
|
options: {
|
|
|
|
map: {
|
2016-06-09 17:02:38 +00:00
|
|
|
inline: false,
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
processors: [
|
|
|
|
require('pixrem')(),
|
2016-06-09 17:02:38 +00:00
|
|
|
require('autoprefixer')({ browsers: 'last 2 versions' }),
|
|
|
|
require('cssnano')(),
|
|
|
|
],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
src: '<%= buildDir %>/baggy.css',
|
2016-10-03 21:08:26 +00:00
|
|
|
dest: '<%= releaseDir %>/themes/baggy/css/style.min.css',
|
2016-06-09 17:02:38 +00:00
|
|
|
},
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
concat: {
|
|
|
|
options: {
|
2016-06-09 17:02:38 +00:00
|
|
|
separator: ';',
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
cssMaterial: {
|
|
|
|
src: [
|
|
|
|
'node_modules/materialize-css/bin/materialize.css',
|
2016-06-09 17:02:38 +00:00
|
|
|
'<%= appDir %>/themes/material/css/*.css',
|
2016-03-08 16:02:34 +00:00
|
|
|
],
|
2016-06-09 17:02:38 +00:00
|
|
|
dest: '<%= buildDir %>/material.css',
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
cssBaggy: {
|
|
|
|
src: [
|
2016-06-09 17:02:38 +00:00
|
|
|
'<%= appDir %>/themes/baggy/css/*.css',
|
2016-03-08 16:02:34 +00:00
|
|
|
],
|
2016-06-09 17:02:38 +00:00
|
|
|
dest: '<%= buildDir %>/baggy.css',
|
|
|
|
},
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
browserify: {
|
2016-09-28 08:30:18 +00:00
|
|
|
dist: {
|
|
|
|
files: {
|
|
|
|
'<%= buildDir %>/material.browser.js': ['<%= appDir %>/themes/material/js/init.js'],
|
|
|
|
'<%= buildDir %>/baggy.browser.js': ['<%= appDir %>/themes/baggy/js/init.js']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
sourceType: "module",
|
|
|
|
transform: [
|
|
|
|
["babelify", {
|
|
|
|
presets: ["es2015"]
|
2016-09-28 16:59:15 +00:00
|
|
|
}], ["browserify-shim", {
|
|
|
|
"jquery": {
|
|
|
|
"exports": "$"
|
|
|
|
},
|
|
|
|
"materialize": "materialize",
|
|
|
|
"jquery-ui": {
|
|
|
|
"depends": "jquery",
|
|
|
|
"exports": null
|
|
|
|
}
|
|
|
|
}]
|
2016-09-28 08:30:18 +00:00
|
|
|
],
|
|
|
|
browserifyOptions: {
|
|
|
|
browser: {
|
|
|
|
"jQuery": "./node_modules/jquery/dist/jquery.js",
|
2016-09-28 16:59:15 +00:00
|
|
|
"jquery.tinydot": "./node_modules/jquery.tinydot/src/jquery.tinydot.js",
|
|
|
|
"jquery.ui": "./node_modules/jquery-ui-browserify/dist/jquery-ui.js"
|
2016-09-28 08:30:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
material: {
|
|
|
|
files: {
|
2016-10-03 21:08:26 +00:00
|
|
|
'<%= releaseDir %>/themes/material/js/material.min.js':
|
2016-06-09 17:02:38 +00:00
|
|
|
['<%= buildDir %>/material.browser.js'],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
baggy: {
|
|
|
|
files: {
|
2016-10-03 21:08:26 +00:00
|
|
|
'<%= releaseDir %>/themes/baggy/js/baggy.min.js':
|
2016-06-09 17:02:38 +00:00
|
|
|
['<%= buildDir %>/baggy.browser.js'],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
pickerjs: {
|
|
|
|
expand: true,
|
2016-09-29 07:18:46 +00:00
|
|
|
cwd: '<%= modulesDir %>/pickadate/lib',
|
2016-03-08 16:02:34 +00:00
|
|
|
src: 'picker.js',
|
2016-06-09 17:02:38 +00:00
|
|
|
dest: '<%= buildDir %>',
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
annotator: {
|
|
|
|
expand: true,
|
2016-09-29 07:18:46 +00:00
|
|
|
cwd: '<%= modulesDir %>/annotator/pkg',
|
2016-03-08 16:02:34 +00:00
|
|
|
src: 'annotator.min.js',
|
2016-06-09 17:02:38 +00:00
|
|
|
dest: '<%= buildDir %>/themes/_global/js/',
|
|
|
|
},
|
2016-03-08 16:02:34 +00:00
|
|
|
baggyfonts: {
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
2016-09-29 07:18:46 +00:00
|
|
|
cwd: '<%= modulesDir %>/icomoon-free-npm/Font',
|
|
|
|
src: 'IcoMoon-Free.ttf',
|
2016-10-03 21:08:26 +00:00
|
|
|
dest: '<%= releaseDir %>/themes/baggy/fonts/',
|
2016-09-29 07:18:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: '<%= modulesDir %>/ptsans-npm-webfont/fonts',
|
2016-10-03 21:08:26 +00:00
|
|
|
src: 'ptsansbold.woff',
|
|
|
|
dest: '<%= releaseDir %>/themes/baggy/fonts/',
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
2016-09-29 07:18:46 +00:00
|
|
|
cwd: '<%= modulesDir %>/material-design-icons-iconfont/dist/fonts/',
|
2016-10-03 21:08:26 +00:00
|
|
|
src: ['MaterialIcons-Regular.eot', 'MaterialIcons-Regular.woff2', 'MaterialIcons-Regular.woff', 'MaterialIcons-Regular.ttf'],
|
|
|
|
dest: '<%= releaseDir %>/themes/baggy/fonts/',
|
2016-06-09 17:02:38 +00:00
|
|
|
},
|
|
|
|
],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
materialfonts: {
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
overwrite: true,
|
2016-09-29 07:18:46 +00:00
|
|
|
cwd: '<%= modulesDir %>/icomoon-free-npm/Font',
|
|
|
|
src: 'IcoMoon-Free.ttf',
|
2016-10-03 21:08:26 +00:00
|
|
|
dest: '<%= releaseDir %>/themes/material/fonts',
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
overwrite: true,
|
2016-09-29 07:18:46 +00:00
|
|
|
cwd: '<%= modulesDir %>/roboto-fontface/fonts/Roboto',
|
2016-06-09 17:02:38 +00:00
|
|
|
src: '*',
|
2016-10-03 21:08:26 +00:00
|
|
|
dest: '<%= releaseDir %>/themes/material/font/roboto',
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
overwrite: true,
|
2016-09-29 07:18:46 +00:00
|
|
|
cwd: '<%= modulesDir %>/material-design-icons-iconfont/dist/fonts/',
|
2016-10-03 21:08:26 +00:00
|
|
|
src: ['MaterialIcons-Regular.eot', 'MaterialIcons-Regular.woff2', 'MaterialIcons-Regular.woff', 'MaterialIcons-Regular.ttf'],
|
|
|
|
dest: '<%= releaseDir %>/themes/material/fonts/',
|
2016-06-09 17:02:38 +00:00
|
|
|
},
|
|
|
|
],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
2016-10-04 08:10:36 +00:00
|
|
|
},
|
|
|
|
symlink: {
|
2016-03-08 16:02:34 +00:00
|
|
|
pics: {
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
overwrite: true,
|
|
|
|
cwd: '<%= appDir %>/themes/_global/',
|
|
|
|
src: 'img',
|
2016-10-03 21:08:26 +00:00
|
|
|
dest: '<%= releaseDir %>/themes/_global/',
|
2016-06-09 17:02:38 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
clean: {
|
|
|
|
css: {
|
2016-06-09 17:02:38 +00:00
|
|
|
src: ['<%= buildDir %>/**/*.css'],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
js: {
|
2016-06-09 17:02:38 +00:00
|
|
|
src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'],
|
2016-03-08 16:02:34 +00:00
|
|
|
},
|
|
|
|
all: {
|
2016-06-09 17:02:38 +00:00
|
|
|
src: ['./<%= buildDir %>'],
|
|
|
|
},
|
2016-10-03 21:08:26 +00:00
|
|
|
release: {
|
|
|
|
src: ['./<%= releaseDir %>/*'],
|
|
|
|
}
|
2016-06-09 17:02:38 +00:00
|
|
|
},
|
2016-10-04 10:14:28 +00:00
|
|
|
eslint: {
|
|
|
|
target: ['<%= appDir %>/themes/material/js/init.js', '<%= appDir %>/themes/baggy/js/init.js']
|
|
|
|
},
|
|
|
|
stylelint: {
|
|
|
|
target: ['<%= appDir %>/themes/material/css/*.css', '<%= appDir %>/themes/baggy/css/*.css']
|
|
|
|
}
|
|
|
|
|
2016-03-08 16:02:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
grunt.registerTask(
|
|
|
|
'fonts',
|
|
|
|
'Install fonts',
|
2016-10-04 08:10:36 +00:00
|
|
|
['copy:baggyfonts', 'copy:materialfonts']
|
2016-03-08 16:02:34 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
grunt.registerTask(
|
|
|
|
'js',
|
|
|
|
'Build and install js files',
|
2016-09-28 08:30:18 +00:00
|
|
|
['clean:js', 'copy:pickerjs', 'browserify', 'uglify']
|
2016-03-08 16:02:34 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
grunt.registerTask(
|
|
|
|
'default',
|
|
|
|
'Build and install everything',
|
2016-10-04 08:10:36 +00:00
|
|
|
['clean', 'copy:pickerjs', 'concat', 'browserify', 'uglify', 'postcss', 'copy', 'symlink']
|
2016-03-08 16:02:34 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
grunt.registerTask(
|
|
|
|
'css',
|
|
|
|
'Compiles the stylesheets.',
|
|
|
|
['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss']
|
|
|
|
);
|
2016-10-04 10:14:28 +00:00
|
|
|
|
|
|
|
grunt.registerTask(
|
|
|
|
'tests',
|
|
|
|
'Test css and js style conformity',
|
2016-10-04 13:59:56 +00:00
|
|
|
['eslint', 'stylelint', 'default']
|
2016-10-04 10:14:28 +00:00
|
|
|
)
|
2016-06-09 17:02:38 +00:00
|
|
|
};
|