From b3aa899ffae9788f23c8f56fafd4e786518e278d Mon Sep 17 00:00:00 2001 From: Dan Mindru Date: Thu, 19 May 2016 15:29:06 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Sketch=20out=20css=20prepr?= =?UTF-8?q?ocessing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +-- gulpfile.js | 5 +++-- package.json | 2 ++ tasks/clean.js | 0 tasks/dupe.js | 0 tasks/less.js | 0 tasks/postcss.js | 20 ++++++++++++++++++++ tasks/sass.js | 0 tasks/watch.js | 3 ++- 9 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 tasks/clean.js create mode 100644 tasks/dupe.js create mode 100644 tasks/less.js create mode 100644 tasks/postcss.js create mode 100644 tasks/sass.js diff --git a/.gitignore b/.gitignore index 3416836..6fd3165 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /vendor/ /node_modules/ -/build/ -/application/ +/tmp/ .DS_Store \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 44f892d..9b45af9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,7 +5,8 @@ var gulp = require('gulp'), var options = { src: 'src', - dist: 'dist' + dist: 'dist', + workingDir: 'tmp' }; /** Load tasks from the '/tasks' directory. @@ -22,4 +23,4 @@ wrench }); /** By default templates will be built into '/dist', then gulp will watch for changes in '/src'. */ -gulp.task('default', ['build', 'watch']); \ No newline at end of file +gulp.task('default', ['dupe', 'postcss', 'less', 'sass', 'build', 'clean', 'watch']); \ No newline at end of file diff --git a/package.json b/package.json index a576bb4..74a2831 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ }, "homepage": "https://github.com/fadeit/responsive-html-email-signature#readme", "devDependencies": { + "autoprefixer": "^6.3.6", "del": "~2.2.0", "gulp": "~3.9.1", "gulp-david": "~0.4.2", @@ -30,6 +31,7 @@ "gulp-inline-image-html": "~0.2.1", "gulp-minify-html": "~1.0.5", "gulp-minify-inline": "~0.2.1", + "gulp-postcss": "^6.1.1", "gulp-preprocess": "~2.0.0", "gulp-rename": "~1.2.2", "q": "~1.4.1", diff --git a/tasks/clean.js b/tasks/clean.js new file mode 100644 index 0000000..e69de29 diff --git a/tasks/dupe.js b/tasks/dupe.js new file mode 100644 index 0000000..e69de29 diff --git a/tasks/less.js b/tasks/less.js new file mode 100644 index 0000000..e69de29 diff --git a/tasks/postcss.js b/tasks/postcss.js new file mode 100644 index 0000000..be67fb7 --- /dev/null +++ b/tasks/postcss.js @@ -0,0 +1,20 @@ +'use strict'; + +var gulp = require('gulp'), + postcss = require('gulp-postcss'), + autoprefixer = require('autoprefixer'); + +function postcssTask(options){ + gulp.task('postcss', function () { + var processors = [ + autoprefixer({browsers: ['Android', 'ChromeAndroid', 'FirefoxAndroid', 'Opera Mini', 'Chrome', 'Firefox', 'Explorer', 'Edge', 'iOS', 'Opera', 'Safari', 'ExplorerMobile']}), + ]; + + //@TODO src & dest + return gulp.src('./src/*.css') + .pipe(postcss(processors)) + .pipe(gulp.dest('./tmp')); + }); +} + +module.exports = postcssTask; \ No newline at end of file diff --git a/tasks/sass.js b/tasks/sass.js new file mode 100644 index 0000000..e69de29 diff --git a/tasks/watch.js b/tasks/watch.js index d64c49b..7d4231a 100644 --- a/tasks/watch.js +++ b/tasks/watch.js @@ -4,7 +4,8 @@ var gulp = require('gulp'); function watchTask(options){ gulp.task('watch', function(){ - gulp.watch([options.src + '/**/*.html', options.src + '/**/*.css', options.src + '/**/conf.js'], ['build']); + //@todo watch less & sass files + gulp.watch([options.src + '/**/*.html', options.src + '/**/*.css', options.src + '/**/conf.js'], ['dupe', 'postcss', 'less', 'sass', 'build', 'clean']); }); }