SHARE
TWEET

Untitled

a guest Apr 21st, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. install extensions via npm
  2. npm install popper.js --save
  3.  
  4. //Require dependencies
  5.  
  6.     var
  7.         gulp = require('gulp'),
  8.         sass = require('gulp-sass'),
  9.         sourcemaps = require('gulp-sourcemaps'),
  10.         concat = require('gulp-concat'),
  11.         uglify = require('gulp-uglify'),
  12.         cleanCSS = require('gulp-clean-css'),
  13.         autoprefixer = require('gulp-autoprefixer'),
  14.         replace = require('gulp-replace')
  15.     ;
  16.  
  17. //Define directories
  18.  
  19.     var
  20.         buildDir = 'assets/build'
  21.     ;
  22.  
  23. //Define paths
  24.    
  25.     var paths = {
  26.         scripts: [
  27.             'node_modules/jquery/dist/jquery.js',
  28.             'node_modules/popper.js/dist/umd/popper.min.js',
  29.             'node_modules/bootstrap/dist/js/bootstrap.js',
  30.         ],
  31.         scss: [
  32.             'assets/scss/style.scss'
  33.         ]
  34.     };
  35.  
  36. // Compile SCSS into CSS and merge Fontello
  37. gulp.task('sass', function () {
  38.     return gulp.src(paths.scss)
  39.         .pipe(sourcemaps.init())
  40.         .pipe(sass().on('error', sass.logError))
  41.         .pipe(autoprefixer({
  42.             browsers: ['ie 10', '> 1%', 'Firefox <= 20']
  43.         }))
  44.         .pipe(cleanCSS({rebase: false}))
  45.         .pipe(concat('style.min.css'))
  46.         .pipe(sourcemaps.write('maps/'))
  47.         .pipe(gulp.dest(buildDir + '/css'))
  48.     ;
  49. });
  50.  
  51. // Minify and merge all JavaScript, compile source maps
  52. gulp.task('scripts', function () {
  53.     return gulp.src(paths.scripts)
  54.         .pipe(sourcemaps.init())
  55.         .pipe(uglify())
  56.         .pipe(concat('all.min.js'))
  57.         .pipe(sourcemaps.write('maps/'))
  58.         .pipe(gulp.dest(buildDir + '/js'))
  59.     ;
  60. });
  61.  
  62.  
  63. //Watch for changes to files and execute relevant tasks
  64. gulp.task('watch', function (){
  65.     gulp.watch(['assets/scss/style.scss', 'assets/scss/**/*.scss'], ['sass']);
  66.     gulp.watch(paths.scripts, ['scripts']);
  67. });
  68.  
  69. gulp.task('default', ['sass','scripts']);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top