1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- const gulp = require('gulp'),
- useref = require('gulp-useref'),
- gulpif = require('gulp-if'),
- uglify = require('gulp-uglify'),
- cleanCSS = require('gulp-clean-css'),
- rename = require("gulp-rename"),
- concat = require("gulp-concat"),
- browserSync = require('browser-sync').create();
- gulp.task('copy', async function() {
- gulp.src('./node_modules/bootstrap/dist/css/bootstrap.css')
- .pipe(gulp.dest('./css/'));
- gulp.src('./node_modules/bootstrap/dist/js/bootstrap.js')
- .pipe(gulp.dest('./js/'));
- gulp.src('./node_modules/jquery/dist/jquery.min.js')
- .pipe(gulp.dest('./js/'));
- console.log("Files copied from npm packages");
- });
- gulp.task('build', async function() {
- gulp.src('./css/bootstrap.css','./css/style.css')
- .pipe(concat('style.min.css'))
- .pipe(gulp.dest('./app/css/'));
- gulp.src('index.html')
- .pipe(useref())
- .pipe(gulpif('*.js', uglify()))
- .pipe(gulpif('*.css', cleanCSS({level: {1: {specialComments: 0}}})))
- .pipe(gulp.dest('./app/'));
- console.log("Assets packaged for app/");
- });
- function run() {
- browserSync.init({
- server: {
- baseDir: "./",
- index: "/index.html"
- }
- });
- gulp.watch('./css/**/*.css').on('change', browserSync.reload);;
- gulp.watch('./*.html').on('change',browserSync.reload);
- gulp.watch('./js/**/*.js').on('change', browserSync.reload);
- }
- exports.run = run;
|