Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. 'use strict';
  2.  
  3. var gulp = require('gulp');
  4.  
  5. var paths = gulp.paths;
  6.  
  7. var $ = require('gulp-load-plugins')();
  8.  
  9. gulp.task('styles', function () {
  10. var sassOptions = {
  11. style: 'expanded'
  12. };
  13.  
  14. var injectFiles = gulp.src([
  15. paths.src + '/{app,components,styles}/**/*.scss',
  16. '!' + paths.src + '/app/styles.scss',
  17. ], { read: false });
  18.  
  19. var injectOptions = {
  20. transform: function(filePath) {
  21. filePath = filePath.replace(paths.src + '/app/', '');
  22. filePath = filePath.replace(paths.src + '/components/', '../components/');
  23. filePath = filePath.replace(paths.src + '/styles/', '../styles/');
  24. return '@import \'' + filePath + '\';';
  25. },
  26. starttag: '// injector',
  27. endtag: '// endinjector',
  28. addRootSlash: false
  29. };
  30.  
  31. var indexFilter = $.filter('styles.scss');
  32.  
  33. return gulp.src([
  34. paths.src + '/app/styles.scss'
  35. ])
  36. .pipe(indexFilter)
  37. //.pipe($.inject(injectFiles, injectOptions))
  38. //.pipe(indexFilter.restore())
  39. .pipe($.sass(sassOptions))
  40. .pipe($.autoprefixer())
  41. .on('error', function handleError(err) {
  42. console.error(err.toString());
  43. this.emit('end');
  44. })
  45. .pipe(gulp.dest(paths.tmp + '/serve/app/'));
  46. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement