Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('style', () => {
return gulp.src([
'./src/css/style.less',
'./src/app/**/*.less'
])
.pipe(sourcemaps.init())
.pipe(less())
// .pipe(csso())
.pipe(concat('style.css'))
.pipe(sourcemaps.write())
// .pipe(uncss({
// html: [ './src/app/**/*.html', './src/index.html' ],
// ignore: [ '.active', 'show-description', 'fa-*', 'user-signed-in',
// 'show-youtube-player', 'fullscreen', 'yt-playing',
// 'transition-in', '[drawer-opened]*']
// }))
.pipe(gulp.dest('.tmp'));
});
gulp.task('useref', () => {
return gulp.src('src/*.html')
.pipe(useref())
.pipe(gulpif('*.css', less())) // compile all .css with less() http://stackoverflow.com/questions/27627936/compiling-less-using-gulp-useref-and-gulp-less
.pipe(gulpif('*.css', autoprefixer({
browsers: ['last 2 versions'],
cascade: false
})))
.pipe(gulpif('*.css', minifyCss()))
.pipe(gulp.dest('dist'))
.pipe(browserSync.reload({
stream: true
}));
});
function ui5AppStylesDist() {
try {
const autoprefix = new LessAutoprefix({
browsers: ['last 2 versions']
})
return paths.appStyles.src.length === 0
? Promise.resolve()
: gulp
.src(paths.appStyles.src, {
base: SRC
})
.pipe(plumber(buildErrorHandler))
// compile LESS to CSS
.pipe(
less({
plugins: [autoprefix]
})
)
// minify CSS
.pipe(
cleanCSS({
level: 2
})
)
.pipe(gulp.dest(DIST))
} catch (error) {
spinner.fail(error)
}
}
gulp.task('styles:less', function () {
return gulp.src('app/styles/*.less')
.pipe(gulpif(args.sourcemaps, sourcemaps.init()))
.pipe(less({ paths: ['./app'] }).on('error', function (error) {
gutil.log(gutil.colors.red('Error (' + error.plugin + '): ' + error.message))
this.emit('end')
}))
.pipe(gulpif(args.production, cleanCSS()))
.pipe(gulpif(args.sourcemaps, sourcemaps.write()))
.pipe(gulp.dest(`dist/${args.vendor}/styles`))
.pipe(gulpif(args.watch, livereload()))
})
function bundle() {
console.log('compiling less %s -> %s', opts.entryPoint, opts.destDir);
return gulp.src(opts.entryPoint)
.pipe(less(lessOpts))
.on('error', cssError)
.pipe(gulp.dest(opts.destDir))
}
/*
return new Promise((resolve) => {
vfs.src(path, getSrcOptions())
.pipe(plumber(handleErros))
.pipe(gulpLess())
.pipe(gulpRename({ extname: '.wxss' }))
.pipe(
gulpif(
isProd(),
gulpCleanCss({}, (details) => {
console.log(`${chalk.blue('=>')} ${chalk.green('originalSize:')} ${details.name}: ${details.stats.originalSize / 1000}kb`);
console.log(`${chalk.blue('=>')} ${chalk.green('minifiedSize:')} ${details.name}: ${details.stats.minifiedSize / 1000}kb`);
})
)
)
.pipe(getDest(vfs))
.on('end', resolve);
});
};
const gulpLess = function (done) {
gulp.src(['plugins/**/*.less'])
.pipe(less())
.pipe(concat('hawkularapm.css'))
.pipe(gulp.dest(config.dist))
.on('end', () => {
done && done();
});
};
function styleBundle() {
const copyImg = gulp.src('themes/**/img/**')
.pipe(gulp.dest('dist/themes'))
.pipe(gulp.dest('examples/libs/css'));
const copyLess = gulp.src('themes/base/main.less')
.pipe(less())
.pipe(rename('uikernel.css'))
.pipe(gulp.dest('dist/themes/base'))
.pipe(gulp.dest('examples/libs/css/base'));
return merge(copyImg, copyLess);
}
gulp.task('prod.client.less', 'Compile less files into css files for production.', () => {
let dest = path.join(CONFIG.paths.dist.public, 'assets');
return gulp.src(CONFIG.paths.distLess, {cwd: CONFIG.paths.source.client})
.pipe(less({paths: CONFIG.paths.lessImports}))
.pipe(gulp.dest(dest));
});
gulp.task('less', ['cleanup'], () => {
return gulp.src('./src/**/*.less')
.pipe(less())
.pipe(gulp.dest('tmp'));
});