Created
May 11, 2020 22:33
-
-
Save denvit/8e494783e45ecaf646cf5ed495a8b0c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright © Magento, Inc. All rights reserved. | |
* See COPYING.txt for license details. | |
*/ | |
// For performance use one level down: 'name/{,*/}*.js' | |
// If you want to recursively match all subfolders, use: 'name/**/*.js' | |
module.exports = function (grunt) { | |
'use strict'; | |
var _ = require('underscore'), | |
path = require('path'), | |
filesRouter = require('./dev/tools/grunt/tools/files-router'), | |
configDir = './dev/tools/grunt/configs', | |
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'), | |
themes; | |
filesRouter.set('themes', 'dev/tools/grunt/configs/themes'); | |
themes = filesRouter.get('themes'); | |
tasks = _.map(tasks, function(task){ return task.replace('.js', '') }); | |
tasks.push('time-grunt'); | |
tasks.forEach(function (task) { | |
require(task)(grunt); | |
}); | |
require('load-grunt-config')(grunt, { | |
configPath: path.join(__dirname, configDir), | |
init: true, | |
jitGrunt: { | |
staticMappings: { | |
usebanner: 'grunt-banner' | |
} | |
} | |
}); | |
_.each({ | |
/** | |
* Assembling tasks. | |
* ToDo: define default tasks. | |
*/ | |
default: function () { | |
grunt.log.subhead('I\'m default task and at the moment I\'m empty, sorry :/'); | |
}, | |
/** | |
* Production preparation task. | |
*/ | |
prod: function (component) { | |
var tasks = [ | |
'less', | |
'autoprefixer', | |
'cssmin', | |
'usebanner' | |
].map(function(task){ | |
return task + ':' + component; | |
}); | |
if (typeof component === 'undefined') { | |
grunt.log.subhead('Tip: Please make sure that u specify prod subtask. By default prod task do nothing'); | |
} else { | |
grunt.task.run(tasks); | |
} | |
}, | |
/** | |
* Refresh themes. | |
*/ | |
refresh: function () { | |
var tasks = [ | |
'clean', | |
'exec:all' | |
]; | |
_.each(themes, function(theme, name) { | |
tasks.push('less:' + name); | |
}); | |
grunt.task.run(tasks); | |
}, | |
/** | |
* Documentation | |
*/ | |
documentation: [ | |
'replace:documentation', | |
'less:documentation', | |
'styledocco:documentation', | |
'usebanner:documentationCss', | |
'usebanner:documentationLess', | |
'usebanner:documentationHtml', | |
'clean:var', | |
'clean:pub' | |
], | |
'legacy-build': [ | |
'mage-minify:legacy' | |
], | |
spec: function (theme) { | |
var runner = require('./dev/tests/js/jasmine/spec_runner'); | |
runner.init(grunt, { theme: theme }); | |
grunt.task.run(runner.getTasks()); | |
} | |
}, function (task, name) { | |
grunt.registerTask(name, task); | |
}); | |
};/** | |
* Copyright © Magento, Inc. All rights reserved. | |
* See COPYING.txt for license details. | |
*/ | |
// For performance use one level down: 'name/{,*/}*.js' | |
// If you want to recursively match all subfolders, use: 'name/**/*.js' | |
module.exports = function (grunt) { | |
'use strict'; | |
var _ = require('underscore'), | |
path = require('path'), | |
filesRouter = require('./dev/tools/grunt/tools/files-router'), | |
configDir = './dev/tools/grunt/configs', | |
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'), | |
themes; | |
filesRouter.set('themes', 'dev/tools/grunt/configs/themes'); | |
themes = filesRouter.get('themes'); | |
tasks = _.map(tasks, function(task){ return task.replace('.js', '') }); | |
tasks.push('time-grunt'); | |
tasks.forEach(function (task) { | |
require(task)(grunt); | |
}); | |
require('load-grunt-config')(grunt, { | |
configPath: path.join(__dirname, configDir), | |
init: true, | |
jitGrunt: { | |
staticMappings: { | |
usebanner: 'grunt-banner' | |
} | |
} | |
}); | |
_.each({ | |
/** | |
* Assembling tasks. | |
* ToDo: define default tasks. | |
*/ | |
default: function () { | |
grunt.log.subhead('I\'m default task and at the moment I\'m empty, sorry :/'); | |
}, | |
/** | |
* Production preparation task. | |
*/ | |
prod: function (component) { | |
var tasks = [ | |
'less', | |
'autoprefixer', | |
'cssmin', | |
'usebanner' | |
].map(function(task){ | |
return task + ':' + component; | |
}); | |
if (typeof component === 'undefined') { | |
grunt.log.subhead('Tip: Please make sure that u specify prod subtask. By default prod task do nothing'); | |
} else { | |
grunt.task.run(tasks); | |
} | |
}, | |
/** | |
* Refresh themes. | |
*/ | |
refresh: function () { | |
var tasks = [ | |
'clean', | |
'exec:all' | |
]; | |
_.each(themes, function(theme, name) { | |
tasks.push('less:' + name); | |
}); | |
grunt.task.run(tasks); | |
}, | |
/** | |
* Documentation | |
*/ | |
documentation: [ | |
'replace:documentation', | |
'less:documentation', | |
'styledocco:documentation', | |
'usebanner:documentationCss', | |
'usebanner:documentationLess', | |
'usebanner:documentationHtml', | |
'clean:var', | |
'clean:pub' | |
], | |
'legacy-build': [ | |
'mage-minify:legacy' | |
], | |
spec: function (theme) { | |
var runner = require('./dev/tests/js/jasmine/spec_runner'); | |
runner.init(grunt, { theme: theme }); | |
grunt.task.run(runner.getTasks()); | |
} | |
}, function (task, name) { | |
grunt.registerTask(name, task); | |
}); | |
};/** | |
* Copyright © Magento, Inc. All rights reserved. | |
* See COPYING.txt for license details. | |
*/ | |
// For performance use one level down: 'name/{,*/}*.js' | |
// If you want to recursively match all subfolders, use: 'name/**/*.js' | |
module.exports = function (grunt) { | |
'use strict'; | |
var _ = require('underscore'), | |
path = require('path'), | |
filesRouter = require('./dev/tools/grunt/tools/files-router'), | |
configDir = './dev/tools/grunt/configs', | |
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'), | |
themes; | |
filesRouter.set('themes', 'dev/tools/grunt/configs/themes'); | |
themes = filesRouter.get('themes'); | |
tasks = _.map(tasks, function(task){ return task.replace('.js', '') }); | |
tasks.push('time-grunt'); | |
tasks.forEach(function (task) { | |
require(task)(grunt); | |
}); | |
require('load-grunt-config')(grunt, { | |
configPath: path.join(__dirname, configDir), | |
init: true, | |
jitGrunt: { | |
staticMappings: { | |
usebanner: 'grunt-banner' | |
} | |
} | |
}); | |
_.each({ | |
/** | |
* Assembling tasks. | |
* ToDo: define default tasks. | |
*/ | |
default: function () { | |
grunt.log.subhead('I\'m default task and at the moment I\'m empty, sorry :/'); | |
}, | |
/** | |
* Production preparation task. | |
*/ | |
prod: function (component) { | |
var tasks = [ | |
'less', | |
'autoprefixer', | |
'cssmin', | |
'usebanner' | |
].map(function(task){ | |
return task + ':' + component; | |
}); | |
if (typeof component === 'undefined') { | |
grunt.log.subhead('Tip: Please make sure that u specify prod subtask. By default prod task do nothing'); | |
} else { | |
grunt.task.run(tasks); | |
} | |
}, | |
/** | |
* Refresh themes. | |
*/ | |
refresh: function () { | |
var tasks = [ | |
'clean', | |
'exec:all' | |
]; | |
_.each(themes, function(theme, name) { | |
tasks.push('less:' + name); | |
}); | |
grunt.task.run(tasks); | |
}, | |
/** | |
* Documentation | |
*/ | |
documentation: [ | |
'replace:documentation', | |
'less:documentation', | |
'styledocco:documentation', | |
'usebanner:documentationCss', | |
'usebanner:documentationLess', | |
'usebanner:documentationHtml', | |
'clean:var', | |
'clean:pub' | |
], | |
'legacy-build': [ | |
'mage-minify:legacy' | |
], | |
spec: function (theme) { | |
var runner = require('./dev/tests/js/jasmine/spec_runner'); | |
runner.init(grunt, { theme: theme }); | |
grunt.task.run(runner.getTasks()); | |
} | |
}, function (task, name) { | |
grunt.registerTask(name, task); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment