From b1d29ef1bcac282a8e9742494ab84a54b5467d75 Mon Sep 17 00:00:00 2001 From: Mohammad Younes Date: Fri, 2 Jan 2015 23:57:08 +0200 Subject: [PATCH] RTL Gulp Task --- gulpfile.js | 59 ++++++++++++++++++++++++++++++++++++++++-- package.json | 1 + tasks/gulp-settings.js | 3 ++- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 107de64a0..7c2d82c85 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -39,6 +39,7 @@ var prompt = require('gulp-prompt'), rename = require('gulp-rename'), replace = require('gulp-replace'), + rtlcss = require('gulp-rtlcss'), sourcemaps = require('gulp-sourcemaps'), uglify = require('gulp-uglify'), util = require('gulp-util'), @@ -406,6 +407,40 @@ gulp.task('build', 'Builds all files from source', function(callback) { }); +gulp.task('build-rtl', 'Builds rtl css from release files', function (callback) { + var + stream + ; + + console.info('Building Semantic RTL'); + + // unified css stream + stream = gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map|*.rtl).css') + .pipe(plumber()) + .pipe(rtlcss()) + .pipe(rename(settings.rename.rtlCSS)) + .pipe(gulp.dest(output.uncompressed)) + .pipe(print(log.created)) + .on('end', function () { + gulp.start('package uncompressed rtl css'); + }) + ; + + stream + .pipe(plumber()) + .pipe(clone()) + .pipe(minifyCSS(settings.minify)) + .pipe(rename(settings.rename.minCSS)) + .pipe(gulp.dest(output.compressed)) + .pipe(print(log.created)) + .on('end', function () { + callback(); + gulp.start('package compressed rtl css'); + }) + ; + +}); + // cleans distribution files gulp.task('clean', 'Clean dist folder', function(callback) { return del([clean], settings.del, callback); @@ -420,7 +455,7 @@ gulp.task('version', 'Displays current version of Semantic', function(callback) ---------------*/ gulp.task('package uncompressed css', false, function() { - return gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map).css') + return gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map|*.rtl).css') .pipe(plumber()) .pipe(replace(assetPaths.uncompressed, assetPaths.packaged)) .pipe(concatCSS('semantic.css')) @@ -429,8 +464,17 @@ gulp.task('package uncompressed css', false, function() { ; }); +gulp.task('package uncompressed rtl css', false, function () { + return gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map).rtl.css') + .pipe(replace(assetPaths.uncompressed, assetPaths.packaged)) + .pipe(concatCSS('semantic.rtl.css')) + .pipe(gulp.dest(output.packaged)) + .pipe(print(log.created)) + ; +}); + gulp.task('package compressed css', false, function() { - return gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map).css') + return gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map|*.rtl).css') .pipe(plumber()) .pipe(replace(assetPaths.uncompressed, assetPaths.packaged)) .pipe(concatCSS('semantic.min.css')) @@ -441,6 +485,17 @@ gulp.task('package compressed css', false, function() { ; }); +gulp.task('package compressed rtl css', false, function () { + return gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map).rtl.css') + .pipe(replace(assetPaths.uncompressed, assetPaths.packaged)) + .pipe(concatCSS('semantic.rtl.min.css')) + .pipe(minifyCSS(settings.minify)) + .pipe(header(banner, settings.header)) + .pipe(gulp.dest(output.packaged)) + .pipe(print(log.created)) + ; +}); + gulp.task('package uncompressed js', false, function() { return gulp.src(output.uncompressed + '**/' + componentGlob + '!(*.min|*.map).js') .pipe(plumber()) diff --git a/package.json b/package.json index 500d8e412..525098f43 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "gulp-prompt": "^0.1.1", "gulp-rename": "^1.2.0", "gulp-replace": "^0.5.0", + "gulp-rtlcss": "^0.1.2", "gulp-sourcemaps": "^1.2.8", "gulp-uglify": "^1.0.1", "gulp-util": "^3.0.1", diff --git a/tasks/gulp-settings.js b/tasks/gulp-settings.js index a7f6a82fc..3d89c8fb5 100644 --- a/tasks/gulp-settings.js +++ b/tasks/gulp-settings.js @@ -39,7 +39,8 @@ module.exports = { rename: { json : { extname : '.json' }, minJS : { extname : '.min.js' }, - minCSS : { extname : '.min.css' } + minCSS : { extname : '.min.css' }, + rtlCSS : { extname : '.rtl.css' }, }, wrench: { recursive: {