Skip to content

Commit

Permalink
Add RTL CSS bundle (#1493)
Browse files Browse the repository at this point in the history
Add an RTL CSS bundle

The RTL bundle does a few things including putting the filter checkboxes on the right side. We probably don't need to build the RTL bundle unless we are building for all languages or locales, however it is so quick that I think it makes sense to just build it during dev mode since it makes developing RTL styling much faster.

J=SLAP-1465
TEST=manual

Build a site with the RTL styling and see the filter checkboxes on the right side
  • Loading branch information
cea2aj authored Jul 30, 2021
1 parent 5896a4b commit dea3a62
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 12 deletions.
27 changes: 27 additions & 0 deletions conf/gulp-tasks/library.gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const { series, parallel, src, dest, watch } = require('gulp');
const path = require('path');
const postcss = require('gulp-postcss');
const sass = require('gulp-sass');
const rtlcss = require('gulp-rtlcss');
const rename = require('gulp-rename');
sass.compiler = require('sass');

const getLibraryVersion = require('./utils/libversion');
Expand Down Expand Up @@ -111,11 +113,36 @@ async function createBundleTaskFactory (locale) {
}

function compileCSS () {
return new Promise(resolve => {
return parallel(compileLtrCSS, compileRtlCSS)(resolve);
});
}

/**
* Compiles the standard left to right CSS
*/
function compileLtrCSS () {
return src('./src/ui/sass/**/*.scss')
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(postcss())
.pipe(dest('./dist/'));
}

/**
* Compiles the right to left CSS which is used for languages such as Arabic
*/
function compileRtlCSS () {
return src('./src/ui/sass/**/*.scss')
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(rtlcss())
.pipe(postcss())
.pipe(rename(function (path) {
path.basename += '.rtl';
}))
.pipe(dest('./dist/'));
}

Expand Down
80 changes: 68 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0",
"gulp-rollup-lightweight": "^1.0.10",
"gulp-rtlcss": "^1.4.2",
"gulp-sass": "^4.1.0",
"gulp-uglify-es": "^2.0.0",
"gulp-umd": "^2.0.0",
Expand Down

0 comments on commit dea3a62

Please sign in to comment.