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