windhamdavid 3 years ago
parent
commit
cc521b3884
2 changed files with 89 additions and 0 deletions
  1. 77 0
      gulpfile.js
  2. 12 0
      src/index.html

+ 77 - 0
gulpfile.js

@@ -0,0 +1,77 @@
+/*global require:true, console:true */
+
+var gulp = require('gulp');
+var nodemon = require('gulp-nodemon');
+var jshint = require('gulp-jshint');
+var uglify = require('gulp-uglify');
+var minifyHTML = require('gulp-minify-html');
+var minifycss = require('gulp-minify-css');
+var concat = require('gulp-concat');
+var del = require('del');
+
+var hintTask = function () {
+  gulp.src(['*.js', './src/js/**/*.js'])
+    .pipe(jshint('.jshintrc'))
+    .pipe(jshint.reporter('jshint-stylish'));
+};
+
+gulp.task('hint', function() {
+  hintTask();
+});
+
+var cleanTask = function () {
+  console.log('CLEAN: Clean Complete');
+  return del([
+    'app/**/*',
+    '!app/img/',
+    '!app/css/',
+    '!app/fonts/',
+    '!app/js/',
+  ]);
+};
+
+gulp.task('clean', function() {
+  cleanTask();
+});
+
+var buildTask = function() {
+  gulp.src('./src/app.js')
+    .pipe(gulp.dest('./app'));
+  gulp.src('./src/index.html')
+    .pipe(minifyHTML())
+    .pipe(gulp.dest('./app'));
+  gulp.src('./src/img/*')
+    .pipe(gulp.dest('./app/img'));
+  gulp.src(['./src/css/main.css'])
+    .pipe(concat('style.min.css'))
+    .pipe(minifycss())
+    .pipe(gulp.dest('./app/css'));
+  gulp.src([])
+    .pipe(concat('vendor.min.js'))
+    .pipe(uglify())
+    .pipe(gulp.dest('./app/js'));
+  gulp.src(['./src/js/script.js'])
+    .pipe(concat('script.min.js'))
+    .pipe(uglify())
+    .pipe(gulp.dest('./app/js'));
+  console.log('BUILD: Build Complete');
+};
+
+gulp.task('build', function() {
+  buildTask();
+});
+
+var nodemonTask = function() {
+  nodemon({
+    tasks: ['watch'],
+    script: 'app.js',
+    verbose: true,
+    env: { 'NODE_ENV': 'development' },
+    watch: ['./src/'],
+    ext: 'css js html'
+  });
+};
+
+gulp.task('run', function () {
+  nodemonTask();
+});

+ 12 - 0
src/index.html

@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<head>
+   <meta charset="utf-8">
+   <meta http-equiv="x-ua-compatible" content="ie=edge">
+   <meta name="viewport" content="width=device-width, initial-scale=1">
+   <title>Juryd</title>
+   <meta name="description" content="">
+   <link rel="stylesheet" href="css/style.css">
+</head>
+<body>
+</body>
+</html>