Skip to content
Snippets Groups Projects
Commit d7c74c79 authored by Denys Rul's avatar Denys Rul
Browse files

MAGETWO-34169: Divide Gruntfile.js into smaller parts

- Split Gruntfile
parent 95197590
Branches
No related merge requests found
Showing
with 568 additions and 572 deletions
This diff is collapsed.
{
"options": {
"browsers": [
"last 2 versions",
"ie 9"
]
},
"setup": {
"src": "<%= path.css.setup %>/setup.css"
}
}
\ No newline at end of file
{
"var": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.tmp %>/cache/**/*",
"<%= path.tmp %>/generation/**/*",
"<%= path.tmp %>/log/**/*",
"<%= path.tmp %>/maps/**/*",
"<%= path.tmp %>/page_cache/**/*",
"<%= path.tmp %>/tmp/**/*",
"<%= path.tmp %>/view/**/*",
"<%= path.tmp %>/view_preprocessed/**/*"
]
}
]
},
"pub": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.pub %>frontend/**/*",
"<%= path.pub %>adminhtml/**/*"
]
}
]
},
"styles": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.tmp %>/view_preprocessed/**/*",
"<%= path.tmp %>/cache/**/*",
"<%= path.pub %>frontend/**/*.less",
"<%= path.pub %>frontend/**/*.css",
"<%= path.pub %>adminhtml/**/*.less",
"<%= path.pub %>adminhtml/**/*.css"
]
}
]
},
"markup": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.tmp %>/cache/**/*",
"<%= path.tmp %>/generation/**/*",
"<%= path.tmp %>/page_cache/**/*"
]
}
]
},
"js": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.pub %>**/*.js",
"<%= path.pub %>**/*.html",
"<%= path.pub %>_requirejs/**/*"
]
}
]
},
"blank": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.tmp %>/cache/**/*",
"<%= combo.autopath(\"blank\", \"pub\") %>**/*",
"<%= combo.autopath(\"blank\", \"tmpLess\") %>**/*",
"<%= combo.autopath(\"blank\", \"tmpSource\") %>**/*"
]
}
]
},
"backend": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.tmp %>/cache/**/*",
"<%= combo.autopath(\"backend\", \"pub\") %>**/*",
"<%= combo.autopath(\"backend\", \"tmpLess\") %>**/*",
"<%= combo.autopath(\"backend\", \"tmpSource\") %>**/*"
]
}
]
},
"luma": {
"force": true,
"files": [
{
"force": true,
"dot": true,
"src": [
"<%= path.tmp %>/cache/**/*",
"<%= combo.autopath(\"luma\", \"pub\") %>**/*",
"<%= combo.autopath(\"luma\", \"tmpLess\") %>**/*",
"<%= combo.autopath(\"luma\", \"tmpSource\") %>**/*"
]
}
]
}
}
\ No newline at end of file
'use strict';
var theme = require('./theme'),
path = require('./path');
/**
* Define Combos for repetitive code.
*/
module.exports = {
collector: function (themeName) {
var cmdPlus = /^win/.test(process.platform) ? ' & ' : ' && ',
command = 'grunt --force clean:' + themeName + cmdPlus;
command = command + 'php -f dev/tools/Magento/Tools/Webdev/less.php --' +
' --locale=' + theme[themeName].locale +
' --area=' + theme[themeName].area +
' --theme=' + theme[themeName].name +
' --files=' + theme[themeName].files.join(',');
return command;
},
autopath: function (themeName) {
return path.pub +
theme[themeName].area + '/' +
theme[themeName].name + '/' +
theme[themeName].locale + '/';
},
lessFiles: function (themeName) {
var lessStringArray = [],
cssStringArray = [],
lessFiles = {},
i = 0;
for (i; i < theme[themeName].files.length; i++) {
cssStringArray[i] = path.pub +
theme[themeName].area + '/' +
theme[themeName].name + '/' +
theme[themeName].locale + '/' +
theme[themeName].files[i] + '.css';
lessStringArray[i] = path.pub +
theme[themeName].area + '/' +
theme[themeName].name + '/' +
theme[themeName].locale + '/' +
theme[themeName].files[i] + '.less';
lessFiles[cssStringArray[i]] = lessStringArray[i];
}
return lessFiles;
}
};
{
"options": {
"stripBanners": true,
"banner": "/**\n * Copyright © <%= grunt.template.today(\"yyyy\") %> Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n"
},
"setup": {
"src": "<%= path.css.setup %>/setup.css",
"dest": "<%= path.css.setup %>/setup.css"
}
}
\ No newline at end of file
{
"options": {
"report": "gzip",
"keepSpecialComments": 0
},
"setup": {
"files": {
"<%= path.css.setup %>/setup.css": "<%= path.css.setup %>/setup.css"
}
}
}
\ No newline at end of file
'use strict';
var combo = require('./combo'),
theme = require('./theme');
/**
* Execution into cmd
*/
module.exports = {
blank: {
cmd: function () {
return combo.collector('blank');
}
},
luma: {
cmd: function () {
return combo.collector('luma');
}
},
backend: {
cmd: function () {
return combo.collector('backend');
}
},
all: {
cmd: function () {
var command = '',
cmdPlus = /^win/.test(process.platform) ? ' & ' : ' && ',
themes = Object.keys(theme),
i = 0;
for (i; i < themes.length; i++) {
command += combo.collector(themes[i]) + cmdPlus;
}
return 'echo ' + command;
}
}
};
'use strict';
var svgo = require('imagemin-svgo');
/**
* Images optimization.
*/
module.exports = {
png: {
options: {
optimizationLevel: 7
},
files: [{
expand: true,
src: ['**/*.png'],
ext: '.png'
}]
},
jpg: {
options: {
progressive: true
},
files: [{
expand: true,
src: ['**/*.jpg'],
ext: '.jpg'
}]
},
gif: {
files: [{
expand: true,
src: ['**/*.gif'],
ext: '.gif'
}]
},
svg: {
options: {
use: [svgo()]
},
files: [{
expand: true,
src: ['**/*.svg'],
ext: '.svg'
}]
}
};
'use strict';
var path = require('path');
module.exports = function (grunt) {
var file = path.join(process.cwd(), 'dev/tests/js/framework/spec_runner'),
specRunner = require(file)(grunt);
return {
options: {
template: require('grunt-template-jasmine-requirejs'),
ignoreEmpty: true
},
'lib-unit': specRunner.configure('unit', 'lib', 8080),
'lib-integration': specRunner.configure('integration', 'lib', 8080),
'backend-unit': specRunner.configure('unit', 'adminhtml', 8000),
'backend-integration': specRunner.configure('integration', 'adminhtml', 8000),
'frontend-unit': specRunner.configure('unit', 'frontend', 3000),
'frontend-integration': specRunner.configure('integration', 'frontend', 3000)
};
};
'use strict';
var combo = require('./combo');
/**
* Compiles Less to CSS and generates necessary files if requested.
*/
module.exports = {
options: {
sourceMap: true,
strictImports: false,
sourceMapRootpath: '/',
dumpLineNumbers: false, // use 'comments' instead false to output line comments for source
ieCompat: false
},
backend: {
files: combo.lessFiles('backend')
},
blank: {
files: combo.lessFiles('blank')
},
luma: {
files: combo.lessFiles('luma')
},
setup: {
files: {
'<%= path.css.setup %>/setup.css': '<%= path.less.setup %>/setup.less'
}
},
documentation: {
files: {
'<%= path.doc %>/docs.css': '<%= path.doc %>/source/docs.less'
}
}
};
{
"legacy": {
"options": {
"type": "yui-js",
"tempPath": "var/cache/",
"options": [
"--nomunge=true"
]
},
"files": {
"<%= path.uglify.legacy %>": [
"lib/web/prototype/prototype.js",
"lib/web/prototype/window.js",
"lib/web/scriptaculous/builder.js",
"lib/web/scriptaculous/effects.js",
"lib/web/lib/ccard.js",
"lib/web/prototype/validation.js",
"lib/web/varien/js.js",
"lib/web/mage/adminhtml/varienLoader.js",
"lib/web/mage/adminhtml/tools.js"
]
}
}
}
\ No newline at end of file
'use strict';
/**
* Define paths.
*/
module.exports = {
pub: 'pub/static/',
tmpLess: 'var/view_preprocessed/less/',
tmpSource: 'var/view_preprocessed/source/',
tmp: 'var',
css: {
setup: 'setup/pub/magento/setup/css'
},
less: {
setup: 'setup/module/Magento/Setup/styles'
},
uglify: {
legacy: 'lib/web/legacy-build.min.js'
},
doc: 'lib/web/css/docs',
spec: 'dev/tests/js/spec'
};
{
"options": {
"shareDir": "base"
},
"backend": {
"options": {
"port": 8000,
"areaDir": "adminhtml",
"theme": "backend"
}
},
"frontend": {
"options": {
"port": 3000,
"areaDir": "frontend",
"theme": "blank"
}
},
"lib": {
"options": {
"port": 8080
}
}
}
\ No newline at end of file
{
"documentation": {
"options": {
"name": "Magento UI Library",
"verbose": true,
"include": [
"<%= path.doc %>/docs.css"
]
},
"files": {
"<%= path.doc %>": "<%= path.doc %>/source"
}
}
}
\ No newline at end of file
'use strict';
/**
* Define Themes
*/
module.exports = {
blank: {
area: 'frontend',
name: 'Magento/blank',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
]
},
luma: {
area: 'frontend',
name: 'Magento/luma',
locale: 'en_US',
files: [
'css/styles-m',
'css/styles-l'
]
},
backend: {
area: 'adminhtml',
name: 'Magento/backend',
locale: 'en_US',
files: [
'css/styles-old',
'css/styles',
'css/pages',
'css/admin'
]
}
};
{
"backend": {
"files": [
"<%= combo.autopath(\"backend\",\"pub\") %>/**/*.less"
],
"tasks": "less:backend"
},
"blank": {
"files": [
"<%= combo.autopath(\"blank\",\"pub\") %>/**/*.less"
],
"tasks": "less:blank"
},
"luma": {
"files": [
"<%= combo.autopath(\"luma\",\"pub\") %>/**/*.less"
],
"tasks": "less:luma"
},
"setup": {
"files": "<%= path.less.setup %>/**/*.less",
"tasks": "less:setup"
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment