You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

95 rivejä
2.2 KiB

  1. "use strict";
  2. var gulp = require('gulp');
  3. var del = require('del');
  4. var concat = require('gulp-concat');
  5. var autoprefixer = require('gulp-autoprefixer');
  6. var minifyCss = require('gulp-cssnano');
  7. var paths = {
  8. build: "dist/",
  9. html: [
  10. 'index.html'
  11. ],
  12. js: [
  13. 'password-generator.js'
  14. ],
  15. js_vendors: [
  16. 'node_modules/lesspass/dist/lesspass.min.js',
  17. 'node_modules/clipboard/dist/clipboard.min.js'
  18. ],
  19. styles: [
  20. 'style.css'
  21. ],
  22. styles_vendors: [
  23. 'node_modules/bootstrap/dist/css/bootstrap.min.css',
  24. 'node_modules/font-awesome/css/font-awesome.min.css',
  25. 'node_modules/hint.css/hint.css'
  26. ],
  27. images: [
  28. 'images/**/*'
  29. ],
  30. fonts: [
  31. 'node_modules/font-awesome/fonts/**/*'
  32. ]
  33. };
  34. gulp.task('clean', function (callback) {
  35. return del(paths.build, {force: true}, callback);
  36. });
  37. gulp.task('fonts', [], function () {
  38. return gulp.src(paths.fonts)
  39. .pipe(gulp.dest(paths.build + 'fonts/'));
  40. });
  41. gulp.task('images', function () {
  42. return gulp.src(paths.images)
  43. .pipe(gulp.dest(paths.build + 'images/'));
  44. });
  45. gulp.task('html', function () {
  46. return gulp.src(paths.html)
  47. .pipe(gulp.dest(paths.build));
  48. });
  49. gulp.task('styles', function () {
  50. return gulp.src(paths.styles)
  51. .pipe(concat('style.min.css'))
  52. .pipe(autoprefixer('last 2 versions'))
  53. .pipe(minifyCss())
  54. .pipe(gulp.dest(paths.build + '/styles'));
  55. });
  56. gulp.task('styles_vendors', function () {
  57. return gulp.src(paths.styles_vendors)
  58. .pipe(gulp.dest(paths.build + 'styles/'));
  59. });
  60. gulp.task('js', function () {
  61. return gulp.src(paths.js)
  62. .pipe(gulp.dest(paths.build + 'js/'));
  63. });
  64. gulp.task('js_vendors', function () {
  65. return gulp.src(paths.js_vendors)
  66. .pipe(gulp.dest(paths.build + 'js/'));
  67. });
  68. gulp.task('build', ['clean'], function () {
  69. gulp.start('js', 'js_vendors', 'html', 'styles', 'styles_vendors', 'fonts', 'images');
  70. });
  71. gulp.task('watch', ['build'], function () {
  72. gulp.watch(paths.js, ['js']);
  73. gulp.watch(paths.js_vendors, ['js_vendors']);
  74. gulp.watch(paths.styles, ['styles']);
  75. gulp.watch(paths.styles_vendors, ['styles_vendors']);
  76. gulp.watch(paths.html, ['html']);
  77. gulp.watch(paths.images, ['images']);
  78. gulp.watch(paths.fonts, ['fonts']);
  79. });
  80. gulp.task('default', ['watch'], function () {
  81. });