Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
Conflicts:
	readme.md
  • Loading branch information
Igloczek committed May 12, 2016
2 parents 99e4090 + 0059614 commit 3702648
Show file tree
Hide file tree
Showing 26 changed files with 227 additions and 244 deletions.
12 changes: 2 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"name": "snowdog/frontools",
"description": "Set of front-end tools for Magento 2, based on Gulp.js",
"version": "0.7.2",
"version": "0.8.0",
"license": "MIT",
"type": "magento2-component",
"extra": {
"map": [
[
"*",
"tools"
]
]
}
"type": "magento2-component"
}
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions config/eslint.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"configFile": "./config/.eslintrc"
}
53 changes: 53 additions & 0 deletions config/themes.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"backend": {
"src" : "app/design/adminhtml/Magento/backend",
"dest" : "pub/static/adminhtml/Magento/backend",
"locale" : ["en_US"],
"lang" : "less",
"default": true,
"area" : "adminhtml",
"vendor" : "Magento",
"name" : "backend",
"files" : [
"css/styles-old",
"css/styles"
]
},
"blank": {
"src" : "app/design/frontend/Magento/blank",
"dest" : "pub/static/frontend/Magento/blank",
"locale" : ["en_US"],
"lang" : "less",
"default": true,
"area" : "frontend",
"vendor" : "Magento",
"name" : "blank",
"files" : [
"css/styles-m",
"css/styles-l",
"css/email",
"css/email-inline"
]
},
"luma": {
"src" : "app/design/frontend/Magento/luma",
"dest" : "pub/static/frontend/Magento/luma",
"locale" : ["en_US"],
"lang" : "less",
"default": true,
"area" : "frontend",
"vendor" : "Magento",
"name" : "luma",
"files" : [
"css/styles-m",
"css/styles-l"
]
},
"sass-blank": {
"src" : "vendor/snowdog/theme-blank-sass",
"dest" : "pub/static/frontend/snowdog/blank",
"locale" : ["en_US", "pl_PL"],
"lang" : "scss",
"postcss": ["plugins.autoprefixer()"]
}
}
32 changes: 0 additions & 32 deletions configs/css-lint.json

This file was deleted.

3 changes: 0 additions & 3 deletions configs/eslint.json

This file was deleted.

53 changes: 0 additions & 53 deletions configs/themes.json.example

This file was deleted.

45 changes: 16 additions & 29 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// plugins / functions / modules
var gulp = require('gulp'),
fs = require('fs'),
plugins = require('gulp-load-plugins')({
pattern: ['*', '!gulp', '!gulp-load-plugins'],
rename: {
Expand All @@ -8,42 +10,27 @@ var gulp = require('gulp'),
}
});

// Check if user create themes configuration
if (!plugins.globby.sync('./configs/themes.json').length) {
plugins.util.log(
plugins.util.colors.red('\n========================================= \n')
+ plugins.util.colors.yellow('You have to create ')
+ plugins.util.colors.blue('configs/themes.json')
+ plugins.util.colors.red('\n=========================================')
);
throw new plugins.util.PluginError({
plugin: 'configs',
message: 'You have to create configs/themes.json'
});
}

var configs = {
'browserSync': require('./configs/browser-sync.json'),
'csslint' : require('./configs/css-lint.json'),
'eslint' : require('./configs/eslint.json'),
'themes' : require('./configs/themes.json')
},
tasks = require('gulp-task-loader')({
dir : 'tasks',
plugins: plugins,
configs: configs
});
// global configuration
var config = {
'themes' : require('./helpers/config-loader')('themes.json', plugins),
'projectPath': fs.realpathSync('../../../') + '/'
};

plugins.browserSync.create();
// tasks loading / creating
require('gulp-task-loader')({
dir : 'tasks',
plugins: plugins,
configs: config
});

// define task for each theme, locale, lang, processing type etc.
// gulp can't run same task in parallel, so we need different names
Object.keys(configs.themes).forEach(name => {
var theme = configs.themes[name];
Object.keys(config.themes).forEach(name => {
var theme = config.themes[name];
theme.locale.forEach(locale => {
gulp.task(
theme.lang + ':' + name + ':' + locale,
require('./helpers/' + theme.lang)(gulp, plugins, configs, name, locale)
require('./helpers/' + theme.lang)(gulp, plugins, config, name, locale)
);
});
});
17 changes: 17 additions & 0 deletions helpers/config-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = function(file, plugins) {
if (plugins.globby.sync('./config/' + file).length) {
return require('../config/' + file);
}
else {
plugins.util.log(
plugins.util.colors.red('\n========================================= \n')
+ plugins.util.colors.yellow('You have to create ')
+ plugins.util.colors.blue('config/' + file)
+ plugins.util.colors.red('\n=========================================')
);
throw new plugins.util.PluginError({
plugin: 'config',
message: 'You have to create config/' + file
});
}
}
27 changes: 0 additions & 27 deletions helpers/css-lint-custom-reporter.js

This file was deleted.

14 changes: 7 additions & 7 deletions helpers/less.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = function(gulp, plugins, configs, name, locale, file) {
module.exports = function(gulp, plugins, config, name, locale, file) {
return () => {
// local vars
var theme = configs.themes[name],
src = theme.dest + '/' + locale,
dest = theme.dest + '/' + locale + '/css',
var theme = config.themes[name],
src = config.projectPath + theme.dest + '/' + locale,
dest = config.projectPath + theme.dest + '/' + locale + '/css',
maps = plugins.util.env.maps || false,
production = plugins.util.env.prod || false,
lessFiles = file || [];
Expand All @@ -12,9 +12,9 @@ module.exports = function(gulp, plugins, configs, name, locale, file) {
// can't figure out what files to process when path is like "theme/**/*.less"
if (!lessFiles.length) {
var files = plugins.globby.sync([
src + '/**/*.less',
'!' + src + '/**/_*.less',
'!' + src + '/node_modules/**/*.less'
config.projectPath + src + '/**/*.less',
'!' + config.projectPath + src + '/**/_*.less',
'!' + config.projectPath + src + '/node_modules/**/*.less'
]);

files.forEach(file => lessFiles.push(file));
Expand Down
12 changes: 7 additions & 5 deletions helpers/scss.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
module.exports = function(gulp, plugins, configs, name, locale, file) {
module.exports = function(gulp, plugins, config, name, locale, file) {
return () => {
// local vars
var theme = configs.themes[name],
src = file || theme.src + '/**/*.scss',
dest = theme.dest + '/' + locale,
var theme = config.themes[name],
src = file || config.projectPath + theme.src + '/**/*.scss',
dest = config.projectPath + theme.dest + '/' + locale,
maps = plugins.util.env.maps || false,
production = plugins.util.env.prod || false,
postcss = theme.postcss || false;

return gulp.src([src, '!' + theme.src + '/node_modules/**/*.scss'], {base: theme.src + '/web'})
return gulp.src([
src, '!' + config.projectPath + theme.src + '/node_modules/**/*.scss'
], {base: config.projectPath + theme.src + '/web'})
.pipe(plugins.plumber({ errorHandler: plugins.notify.onError("Error: <%= error.message %>") }))
.pipe(plugins.if(maps, plugins.sourcemaps.init()))
.pipe(plugins.sass())
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@
"url": "https://github.com/SnowdogApps/magento2-frontools"
},
"license": "MIT",
"engines": "node >= 4.2.6",
"devDependencies": {
"autoprefixer": "6.3.6",
"browser-sync": "2.12.2",
"browser-sync": "2.12.8",
"cssnano": "3.5.2",
"globby": "4.0.0",
"gulp": "3.9.1",
"gulp-concat": "2.6.0",
"gulp-csslint": "0.3.0",
"gulp-eslint": "1.1.1",
"gulp-if": "2.0.0",
"gulp-less": "3.0.5",
"gulp-load-plugins": "1.2.0",
"gulp-eslint": "2.0.0",
"gulp-if": "2.0.1",
"gulp-less": "3.1.0",
"gulp-load-plugins": "1.2.2",
"gulp-logger": "0.0.2",
"gulp-notify": "2.2.0",
"gulp-plumber": "1.1.0",
"gulp-postcss": "6.1.0",
"gulp-postcss": "6.1.1",
"gulp-rimraf": "0.2.0",
"gulp-sass": "2.2.0",
"gulp-sass": "2.3.1",
"gulp-sourcemaps": "1.6.0",
"gulp-task-loader": "1.4.2",
"gulp-uglify": "1.5.3",
Expand Down
Loading

0 comments on commit 3702648

Please sign in to comment.