Skip to content

Instantly share code, notes, and snippets.

@willbowling
Created March 17, 2016 13:43
Show Gist options
  • Save willbowling/92f4a67447477af4c1be to your computer and use it in GitHub Desktop.
Save willbowling/92f4a67447477af4c1be to your computer and use it in GitHub Desktop.
Gulp RTL and Autoprefixer Tasks
var gulp = require('gulp');
// var async = require('async');
// var Q = require('q');
// var glob = require('glob');
// var spawn = require('child_process').spawn;
// var argv = require('yargs').argv;
// var path = require('path');
// var watch = require('gulp-watch');
// var _ = require('underscore');
var autoprefixer = require('gulp-autoprefixer');
var rtlcss = require('gulp-rtlcss');
var rename = require('gulp-rename');
gulp.task('css-theme', function () {
return gulp.src(['../docroot/sites/all/themes/custom/atlas/css/**/*.css', '!../docroot/sites/all/themes/custom/atlas/css/**/*-rtl.css'], {base: '../docroot/sites/all/themes/custom/atlas/css/**/' })
.pipe(autoprefixer(["last 2 versions", "> 1%"]))
// .pipe(gulp.dest('../docroot/sites/all/themes/custom/atlas/css/**/')) // Output LTR stylesheets.
.pipe(rtlcss()) // Convert to RTL.
.pipe(rename({ suffix: '-rtl' })) // Append "-rtl" to the filename.
.pipe(gulp.dest('../docroot/sites/all/themes/custom/atlas/css/**/')); // Output RTL stylesheets.
});
gulp.task('css-module', function () {
return gulp.src(['../docroot/sites/all/modules/glomo/modules/**/*.css', '!../docroot/sites/all/modules/glomo/modules/**/*-rtl.css'], { base: '../docroot/sites/all/modules/glomo/modules/**/' })
.pipe(autoprefixer(["last 2 versions", "> 1%"]))
// .pipe(gulp.dest('../docroot/sites/all/modules/glomo/modules/**/')) // Output LTR stylesheets.
.pipe(rtlcss()) // Convert to RTL.
.pipe(rename({ suffix: '-rtl' })) // Append "-rtl" to the filename.
.pipe(gulp.dest('../docroot/sites/all/modules/glomo/modules/**/')); // Output RTL stylesheets.
});
gulp.task('css-shared', function () {
return gulp.src(['../docroot/sites/all/modules/glomo/shared/**/*.css', '!../docroot/sites/all/modules/glomo/shared/**/*-rtl.css'], { base: '../docroot/sites/all/modules/glomo/shared/**/' })
.pipe(autoprefixer(["last 2 versions", "> 1%"]))
// .pipe(gulp.dest('../docroot/sites/all/modules/glomo/shared/**/')) // Output LTR stylesheets.
.pipe(rtlcss()) // Convert to RTL.
.pipe(rename({ suffix: '-rtl' })) // Append "-rtl" to the filename.
.pipe(gulp.dest('../docroot/sites/all/modules/glomo/shared/**/')); // Output RTL stylesheets.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment