1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-27 12:26:31 +01:00
bitwarden-mobile/gulpfile.js

42 lines
1003 B
JavaScript
Raw Normal View History

2019-04-03 04:43:22 +02:00
const gulp = require('gulp');
2019-04-03 05:41:17 +02:00
const gulpSass = require('gulp-sass');
2019-04-03 04:43:22 +02:00
const del = require('del');
2019-04-03 05:22:37 +02:00
const fs = require('fs');
2019-04-03 05:41:17 +02:00
gulpSass.compiler = require('node-sass');
2019-04-03 05:22:37 +02:00
const paths = {
css: './src/App/Css',
};
2019-04-03 05:41:17 +02:00
const sassFiles = [
'./src/App/Sass/android.scss',
'./src/App/Sass/ios.scss',
'./src/App/Sass/dark.scss',
'./src/App/Sass/styles.scss',
2019-04-03 05:22:37 +02:00
];
2019-04-03 04:43:22 +02:00
2019-04-03 05:41:17 +02:00
function sass() {
return gulp.src(sassFiles)
.pipe(gulpSass().on('error', gulpSass.logError))
.pipe(gulp.dest(paths.css));
2019-04-03 05:22:37 +02:00
}
2019-04-03 05:41:17 +02:00
function fixSass(cb) {
2019-04-03 05:22:37 +02:00
fs.readdir(paths.css, (err, cssFiles) => {
cssFiles.forEach((cssFile) => {
const file = paths.css + '/' + cssFile;
let fileContents = fs.readFileSync(file, 'utf8');
2019-04-03 05:41:17 +02:00
fileContents = fileContents.replace(/__/g, '^');
2019-04-03 05:22:37 +02:00
fs.writeFileSync(file, fileContents, 'utf8');
});
cb();
});
2019-04-03 04:43:22 +02:00
}
function cleanCss() {
2019-04-03 05:22:37 +02:00
return del(paths.css);
2019-04-03 04:43:22 +02:00
}
2019-04-03 05:41:17 +02:00
exports.sass = gulp.series(cleanCss, sass, fixSass);