init
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var themes = require('../tools/files-router').get('themes'),
|
||||
_ = require('underscore');
|
||||
|
||||
var themeOptions = {};
|
||||
|
||||
_.each(themes, function(theme, name) {
|
||||
themeOptions[name] = {
|
||||
"force": true,
|
||||
"files": [
|
||||
{
|
||||
"force": true,
|
||||
"dot": true,
|
||||
"src": [
|
||||
"<%= path.tmp %>/cache/**/*",
|
||||
"<%= combo.autopath(\""+name+"\", path.pub ) %>**/*",
|
||||
"<%= combo.autopath(\""+name+"\", path.tmpLess) %>**/*",
|
||||
"<%= combo.autopath(\""+name+"\", path.tmpSource) %>**/*",
|
||||
"<%= path.deployedVersion %>"
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
var cleanOptions = {
|
||||
"var": {
|
||||
"force": true,
|
||||
"files": [
|
||||
{
|
||||
"force": true,
|
||||
"dot": true,
|
||||
"src": [
|
||||
"<%= path.tmp %>/cache/**/*",
|
||||
"<%= 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/**/*",
|
||||
"<%= path.deployedVersion %>"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"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",
|
||||
"<%= path.deployedVersion %>"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"markup": {
|
||||
"force": true,
|
||||
"files": [
|
||||
{
|
||||
"force": true,
|
||||
"dot": true,
|
||||
"src": [
|
||||
"<%= path.tmp %>/cache/**/*",
|
||||
"<%= path.tmp %>/view_preprocessed/html/**/*",
|
||||
"<%= path.tmp %>/page_cache/**/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"js": {
|
||||
"force": true,
|
||||
"files": [
|
||||
{
|
||||
"force": true,
|
||||
"dot": true,
|
||||
"src": [
|
||||
"<%= path.pub %>**/*.js",
|
||||
"<%= path.pub %>**/*.html",
|
||||
"<%= path.pub %>_requirejs/**/*",
|
||||
"<%= path.deployedVersion %>"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"generation": {
|
||||
"force": true,
|
||||
"files": [
|
||||
{
|
||||
"force": true,
|
||||
"dot": true,
|
||||
"src": [
|
||||
"<%= path.generation %>code/**/*",
|
||||
"<%= path.generation %>metadata/**/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = _.extend(cleanOptions, themeOptions);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var theme = require('../tools/files-router').get('themes'),
|
||||
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 bin/magento dev:source-theme:deploy ' +
|
||||
theme[themeName].files.join(' ') +
|
||||
' --type=less' +
|
||||
' --locale=' + theme[themeName].locale +
|
||||
' --area=' + theme[themeName].area +
|
||||
' --theme=' + theme[themeName].name;
|
||||
|
||||
return command;
|
||||
},
|
||||
|
||||
autopath: function (themeName, folder) {
|
||||
return folder +
|
||||
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;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"options": {
|
||||
"report": "gzip",
|
||||
"keepSpecialComments": 0
|
||||
},
|
||||
"setup": {
|
||||
"files": {
|
||||
"<%= path.css.setup %>/setup.css": "<%= path.css.setup %>/setup.css"
|
||||
}
|
||||
},
|
||||
"updater": {
|
||||
"files": {
|
||||
"<%= path.css.updater %>/updater.css": "<%= path.css.updater %>/updater.css"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"file": {
|
||||
"options": {
|
||||
"overrideConfigFile": "vendor/magento/magento-coding-standard/eslint/.eslintrc",
|
||||
"rulePaths": ["vendor/magento/magento-coding-standard/eslint/rules"],
|
||||
"useEslintrc": false
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"options": {
|
||||
"overrideConfigFile": "vendor/magento/magento-coding-standard/eslint/.eslintrc",
|
||||
"rulePaths": ["vendor/magento/magento-coding-standard/eslint/rules"],
|
||||
"outputFile": "dev/tests/static/eslint-error-report.xml",
|
||||
"format": "junit",
|
||||
"quiet": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var combo = require('./combo'),
|
||||
themes = require('../tools/files-router').get('themes'),
|
||||
_ = require('underscore');
|
||||
|
||||
var themeOptions = {};
|
||||
|
||||
_.each(themes, function(theme, name) {
|
||||
themeOptions[name] = {
|
||||
cmd: combo.collector.bind(combo, name)
|
||||
};
|
||||
});
|
||||
|
||||
var execOptions = {
|
||||
all : {
|
||||
cmd: function () {
|
||||
var cmdPlus = (/^win/.test(process.platform) == true) ? ' & ' : ' && ',
|
||||
command;
|
||||
|
||||
command = _.map(themes, function(theme, name) {
|
||||
return combo.collector(name);
|
||||
}).join(cmdPlus);
|
||||
|
||||
return 'echo ' + command;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Execution into cmd
|
||||
*/
|
||||
module.exports = _.extend(themeOptions, execOptions);
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'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'
|
||||
}]
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var combo = require('./combo'),
|
||||
themes = require('../tools/files-router').get('themes'),
|
||||
_ = require('underscore');
|
||||
|
||||
var themeOptions = {};
|
||||
|
||||
_.each(themes, function(theme, name) {
|
||||
themeOptions[name] = {
|
||||
files: combo.lessFiles(name)
|
||||
};
|
||||
});
|
||||
|
||||
var lessOptions = {
|
||||
options: {
|
||||
sourceMap: true,
|
||||
strictImports: false,
|
||||
sourceMapRootpath: '/',
|
||||
sourceMapBasepath: function (f) {
|
||||
this.sourceMapURL = this.sourceMapFilename.substr(this.sourceMapFilename.lastIndexOf('/') + 1);
|
||||
return "/";
|
||||
},
|
||||
dumpLineNumbers: false, // use 'comments' instead false to output line comments for source
|
||||
ieCompat: false
|
||||
},
|
||||
setup: {
|
||||
files: {
|
||||
'<%= path.css.setup %>/setup.css': '<%= path.less.setup %>/_setup.less'
|
||||
}
|
||||
},
|
||||
updater: {
|
||||
files: {
|
||||
'<%= path.css.updater %>/updater.css': '<%= path.less.setup %>/_setup.less'
|
||||
}
|
||||
},
|
||||
documentation: {
|
||||
files: {
|
||||
'<%= path.doc %>/docs.css': '<%= path.doc %>/source/docs.less'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Compiles Less to CSS and generates necessary files if requested.
|
||||
*/
|
||||
module.exports = _.extend(themeOptions, lessOptions);
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"legacy": {
|
||||
"options": {
|
||||
"compressor": "yui-js"
|
||||
},
|
||||
"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",
|
||||
"dev/tools/grunt/assets/legacy-build/shim.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Define paths.
|
||||
*/
|
||||
module.exports = {
|
||||
pub: 'pub/static/',
|
||||
tmpLess: 'var/view_preprocessed/less/',
|
||||
tmpSource: 'var/view_preprocessed/source/',
|
||||
tmp: 'var',
|
||||
deployedVersion: 'pub/static/deployed_version.txt',
|
||||
css: {
|
||||
setup: 'setup/pub/styles',
|
||||
updater: '../magento2-updater/pub/css'
|
||||
},
|
||||
less: {
|
||||
setup: 'app/design/adminhtml/Magento/backend/web/app/setup/styles/less',
|
||||
updater: 'app/design/adminhtml/Magento/backend/web/app/updater/styles/less'
|
||||
},
|
||||
uglify: {
|
||||
legacy: 'lib/web/legacy-build.min.js'
|
||||
},
|
||||
doc: 'lib/web/css/docs',
|
||||
spec: 'dev/tests/js/spec',
|
||||
static: {
|
||||
dir: 'dev/tests/static/testsuite/Magento/Test/Js/_files',
|
||||
whitelist: 'dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/',
|
||||
blacklist: 'dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/',
|
||||
tmp: 'validation-files.txt'
|
||||
},
|
||||
generation: 'generated/'
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var nlWin = '\r\n',
|
||||
nlUnix = '\n';
|
||||
|
||||
function findCopyright(lang, nlSys) {
|
||||
var copyrightText = {
|
||||
firstLine: 'Copyright © Magento, Inc. All rights reserved.',
|
||||
secondLine: 'See COPYING.txt for license details.'
|
||||
};
|
||||
switch (lang) {
|
||||
case 'less':
|
||||
return new RegExp(
|
||||
'// /\\*\\*' + nlSys + '// \\* ' +
|
||||
copyrightText.firstLine +
|
||||
'' + nlSys + '// \\* ' +
|
||||
copyrightText.secondLine +
|
||||
'' + nlSys + '// \\*/' + nlSys + nlSys
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
documentation: {
|
||||
options: {
|
||||
patterns: [
|
||||
{
|
||||
match: findCopyright('less', nlWin),
|
||||
replacement: ''
|
||||
},
|
||||
{
|
||||
match: findCopyright('less', nlUnix),
|
||||
replacement: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
files: [{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: [
|
||||
'<%= path.doc %>/source/**/*.less'
|
||||
],
|
||||
dest: '<%= path.doc %>/source/'
|
||||
}]
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"documentation": {
|
||||
"options": {
|
||||
"name": "Magento UI Library",
|
||||
"verbose": true,
|
||||
"include": ["<%= path.doc %>/docs.css"]
|
||||
},
|
||||
"files": {
|
||||
"<%= path.doc %>": "<%= path.doc %>/source"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Define Themes
|
||||
*
|
||||
* area: area, one of (frontend|adminhtml|doc),
|
||||
* name: theme name in format Vendor/theme-name,
|
||||
* locale: locale,
|
||||
* files: [
|
||||
* 'css/styles-m',
|
||||
* 'css/styles-l'
|
||||
* ],
|
||||
* dsl: dynamic stylesheet language (less|sass)
|
||||
*
|
||||
*/
|
||||
module.exports = {
|
||||
blank: {
|
||||
area: 'frontend',
|
||||
name: 'Magento/blank',
|
||||
locale: 'en_US',
|
||||
files: [
|
||||
'css/styles-m',
|
||||
'css/styles-l',
|
||||
'css/email',
|
||||
'css/email-inline'
|
||||
],
|
||||
dsl: 'less'
|
||||
},
|
||||
luma: {
|
||||
area: 'frontend',
|
||||
name: 'Magento/luma',
|
||||
locale: 'en_US',
|
||||
files: [
|
||||
'css/styles-m',
|
||||
'css/styles-l'
|
||||
],
|
||||
dsl: 'less'
|
||||
},
|
||||
backend: {
|
||||
area: 'adminhtml',
|
||||
name: 'Magento/backend',
|
||||
locale: 'en_US',
|
||||
files: [
|
||||
'css/styles-old',
|
||||
'css/styles'
|
||||
],
|
||||
dsl: 'less'
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
function printCopyright(lang) {
|
||||
var copyrightText = {
|
||||
firstLine: 'Copyright © Magento, Inc. All rights reserved.',
|
||||
secondLine: 'See COPYING.txt for license details.'
|
||||
},
|
||||
nlWin = '\r\n';
|
||||
switch (lang) {
|
||||
case 'css':
|
||||
return '/**' + nlWin + ' * ' + copyrightText.firstLine + nlWin + ' * ' + copyrightText.secondLine + nlWin + ' */' + nlWin;
|
||||
break;
|
||||
case 'less':
|
||||
return '// /**' + nlWin + '// * ' + copyrightText.firstLine + nlWin + '// * ' + copyrightText.secondLine + nlWin + '// */' + nlWin;
|
||||
break;
|
||||
case 'html':
|
||||
return '<!--' + nlWin + '/**' + nlWin + ' * ' + copyrightText.firstLine + nlWin + ' * ' + copyrightText.secondLine + nlWin + ' */' + nlWin + '-->' + nlWin;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
options: {
|
||||
position: 'top',
|
||||
linebreak: true
|
||||
},
|
||||
setup: {
|
||||
options: {
|
||||
banner: printCopyright('css')
|
||||
},
|
||||
files: {
|
||||
src: '<%= path.css.setup %>/*.css'
|
||||
}
|
||||
},
|
||||
updater: {
|
||||
options: {
|
||||
banner: printCopyright('css')
|
||||
},
|
||||
files: {
|
||||
src: '<%= path.css.updater %>/updater.css'
|
||||
}
|
||||
},
|
||||
documentationCss: {
|
||||
options: {
|
||||
banner: printCopyright('css')
|
||||
},
|
||||
files: {
|
||||
src: '<%= path.doc %>/**/*.css'
|
||||
}
|
||||
},
|
||||
documentationLess: {
|
||||
options: {
|
||||
banner: printCopyright('less')
|
||||
},
|
||||
files: {
|
||||
src: '<%= path.doc %>/**/*.less'
|
||||
}
|
||||
},
|
||||
documentationHtml: {
|
||||
options: {
|
||||
banner: printCopyright('html')
|
||||
},
|
||||
files: {
|
||||
src: '<%= path.doc %>/**/*.html'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var combo = require('./combo'),
|
||||
themes = require('../tools/files-router').get('themes'),
|
||||
_ = require('underscore');
|
||||
|
||||
var themeOptions = {};
|
||||
|
||||
_.each(themes, function (theme, name) {
|
||||
themeOptions[name] = {
|
||||
'files': [
|
||||
'<%= combo.autopath(\''+name+'\', path.pub) %>/**/*.less'
|
||||
],
|
||||
'tasks': 'less:' + name
|
||||
};
|
||||
});
|
||||
|
||||
var watchOptions = {
|
||||
'setup': {
|
||||
'files': '<%= path.less.setup %>/**/*.less',
|
||||
'tasks': 'less:setup'
|
||||
},
|
||||
'updater': {
|
||||
'options': {
|
||||
livereload: true
|
||||
},
|
||||
'files': '<%= path.less.updater %>/**/*.less',
|
||||
'tasks': 'less:updater'
|
||||
},
|
||||
'reload': {
|
||||
'files': '<%= path.pub %>/**/*.css',
|
||||
'options': {
|
||||
livereload: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = _.extend(themeOptions, watchOptions);
|
||||
Reference in New Issue
Block a user