<commit_before>## Instalamos Dependencias
```sh
npm install --save-dev gulp browser-sync gulp-minify-html gulp-sass gulp-autoprefixer gulp-minify-css gulp-rename gulp-uncss gulp-jshint gulp-uglify gulp-concat gulp-imagemin imagemin-pngquant gulp-cache del gulp-inject wiredep gulp-install
```

##Declaramos las dependencias
```javascript
var gulp      = require('gulp');
var browserSync   = require('browser-sync');
var reload      = browserSync.reload;
var minifyHTML    = require('gulp-minify-html');
var sass      = require('gulp-sass');
var autoprefixer    = require('gulp-autoprefixer');
var minifycss   = require('gulp-minify-css');
var rename      = require('gulp-rename');
var uncss     = require('gulp-uncss');
var jshint      = require('gulp-jshint');
var uglify      = require('gulp-uglify');
var concat      = require('gulp-concat');
var imagemin    = require('gulp-imagemin');
var pngquant    = require('imagemin-pngquant');
var cache     = require('gulp-cache');
var del     = require('del');
var inject      = require('gulp-inject');
var wiredep     = require('wiredep').stream;
var install     = require("gulp-install");
```
##Declaramos las variables globales
```javascript
//Variables
var config = {
  html: {
    main: './app/index.html',
    watch: './app/**/*.html',
    output: './dist'
  },
  styles: {
    main: './app/styles/scss/style.scss',
    watch: './app/styles/scss/**/*.scss',
    app: './app/styles',
    output: './dist/styles'
  },
  scripts: {
    main: './app/scripts/main.js',
    watch: './app/scripts/**/*.js',
    app: './app/scripts',
    output: './dist/scripts'
  },
  images: {
    main: './app/images/resources/**',
    watch: './app/images/**/*.*',
    app: './app/images',
    output: './dist/images'
  }
};

```
##Servidor - Browsersync
[Browsersync](http://www.browsersync.io/ )
```javascript
//Servidor - Browsersync
gulp.task('serve', function () {
  browserSync({
    notify: false,
    logPrefix: 'BS',
    server: {
      baseDir: [ './app', './dist']
    },
    host: '0.0.0.0',  //Mediante el host tenemos acceso externo
    port: 8080,
    ui: {
      port: 8081
    },
    browser: ["google-chrome", "firefox"] //Escogemos el navegador, por dafault es el predeterminado

  });
});
```

##HTML
[gulp-minify](https://www.npmjs.com/package/gulp-minify-html)  
**Tasks**
```javascript
//HTML minificado
gulp.task('html', function() {
  var opts = {
    conditionals: true,
    spare:true
  };
  return gulp.src(config.html.main)
  .pipe(minifyHTML(opts))
  .pipe(gulp.dest(config.html.output));
});
Watch & reload
gulp.watch(config.html.watch, ['build'], reload);
```
##Styles
[gulp-sass](https://www.npmjs.com/package/gulp-sass)  
[gulp-autoprefixer](https://www.npmjs.com/package/gulp-autoprefixer)  
[gulp-minify-css](https://www.npmjs.com/package/gulp-minify-css)  
[gulp-rename](https://www.npmjs.com/package/gulp-rename)  
[gulp-uncss](https://www.npmjs.com/package/gulp-uncss)  

**Tasks**
```javascript
//Styles: CSS  Minificado
gulp.task('styles', ['build:styles'], function() {
    gulp.start('uncss');
});
gulp.task('build:styles', function(){
  return gulp.src(config.styles.main)
  .pipe(sass().on('error', sass.logError))
  .pipe(autoprefixer('last 2 version'))
  .pipe(gulp.dest(config.styles.app))
  .pipe(rename({ suffix: '.min' }))
  .pipe(minifycss())
  .pipe(gulp.dest(config.styles.app));
});
// Optimiza styles.min.css
gulp.task('uncss', function() {
  return gulp.src(config.styles.app + '/style.min.css')
  .pipe(uncss({
    html: ['index.html', 'app/**/*.html']
    }))
  .pipe(gulp.dest(config.styles.output))
  .pipe(gulp.dest(config.styles.app));
});
```
**Watch & reload**
```javascript
gulp.watch(config.styles.watch, ['styles'], reload);
```

##Scripts
[gulp-uglify](https://www.npmjs.com/package/gulp-uglify)  
[gulp-jshint](https://www.npmjs.com/package/gulp-jshint)  
[gulp-concat](https://www.npmjs.com/package/gulp-concat)  

**Tasks**
```javascript
// Scripts: todos los archivos JS concatenados en uno solo minificado
gulp.task('scripts', function() {
  return gulp.src([config.scripts.app+'/js/*.js'])
  .pipe(jshint('.jshintrc'))
  .pipe(jshint.reporter('default'))
  .pipe(concat('main.js'))
  .pipe(rename({ suffix: '.min' }))
  .pipe(uglify())
  .pipe(gulp.dest(config.scripts.output))
  .pipe(gulp.dest(config.scripts.app));
});
```
**Watch & reload**
```javascript
gulp.watch(config.scripts.watch, ['scripts'], reload);
```

##Images
[gulp-imagemin](https://www.npmjs.com/package/gulp-imagemin)  
[imagemin-pngquant](https://www.npmjs.com/package/imagemin-pngquant)  
[gulp-cache](https://github.com/jgable/gulp-cache)  
[del](https://www.npmjs.com/package/del)  
```
**Tasks**
```javascript
// Images
gulp.task('images', ['build:images'], function() {
  gulp.start('clean:images');
});
gulp.task('build:images', ['copy:images'], function() {
  return gulp.src(config.images.main)
  .pipe(cache(imagemin({
    optimizationLevel: 3,
    progressive: true,
    interlaced: true,
    use: [pngquant()]
  })))
  .pipe(gulp.dest(config.images.app))
  .pipe(gulp.dest(config.images.output));
});
gulp.task('copy:images', function() {
  return gulp.src(config.images.app + '/*.*')
  .pipe(gulp.dest(config.images.output));
});
gulp.task('clean:images', function(cb) {
  del(config.images.main + '/*.*', cb);
});
```
**Watch & reload**
```javascript
gulp.watch(config.images.watch, ['images'], reload);
```<commit_msg>Arreglado gulpfile.js<commit_after>## Instalamos Dependencias
```sh
npm install --save-dev gulp browser-sync gulp-minify-html gulp-sass gulp-autoprefixer gulp-minify-css gulp-rename gulp-uncss gulp-jshint gulp-uglify gulp-concat gulp-imagemin imagemin-pngquant gulp-cache del gulp-inject wiredep gulp-install
```

##Declaramos las dependencias
```javascript
var gulp      = require('gulp');
var browserSync   = require('browser-sync');
var reload      = browserSync.reload;
var minifyHTML    = require('gulp-minify-html');
var sass      = require('gulp-sass');
var autoprefixer    = require('gulp-autoprefixer');
var minifycss   = require('gulp-minify-css');
var rename      = require('gulp-rename');
var uncss     = require('gulp-uncss');
var jshint      = require('gulp-jshint');
var uglify      = require('gulp-uglify');
var concat      = require('gulp-concat');
var imagemin    = require('gulp-imagemin');
var pngquant    = require('imagemin-pngquant');
var cache     = require('gulp-cache');
var del     = require('del');
var inject      = require('gulp-inject');
var wiredep     = require('wiredep').stream;
var install     = require("gulp-install");
```
##Declaramos las variables globales
```javascript
//Variables
var config = {
  html: {
    main: './app/index.html',
    watch: './app/**/*.html',
    output: './dist'
  },
  styles: {
    main: './app/styles/scss/style.scss',
    watch: './app/styles/scss/**/*.scss',
    app: './app/styles',
    output: './dist/styles'
  },
  scripts: {
    main: './app/scripts/main.js',
    watch: './app/scripts/**/*.js',
    app: './app/scripts',
    output: './dist/scripts'
  },
  images: {
    main: './app/images/resources/**',
    watch: './app/images/**/*.*',
    app: './app/images',
    output: './dist/images'
  }
};

```
##Servidor - Browsersync
[Browsersync](http://www.browsersync.io/ )
```javascript
//Servidor - Browsersync
gulp.task('serve', function () {
  browserSync({
    notify: false,
    logPrefix: 'BS',
    server: {
      baseDir: [ './app', './dist']
    },
    host: '0.0.0.0',  //Mediante el host tenemos acceso externo
    port: 8080,
    ui: {
      port: 8081
    },
    browser: ["google-chrome", "firefox"] //Escogemos el navegador, por dafault es el predeterminado

  });
});
```

##HTML
[gulp-minify](https://www.npmjs.com/package/gulp-minify-html)  
**Tasks**
```javascript
//HTML minificado
gulp.task('html', function() {
  var opts = {
    conditionals: true,
    spare:true
  };
  return gulp.src(config.html.main)
  .pipe(minifyHTML(opts))
  .pipe(gulp.dest(config.html.output));
});
Watch & reload
gulp.watch(config.html.watch, ['build'], reload);
```
##Styles
[gulp-sass](https://www.npmjs.com/package/gulp-sass)  
[gulp-autoprefixer](https://www.npmjs.com/package/gulp-autoprefixer)  
[gulp-minify-css](https://www.npmjs.com/package/gulp-minify-css)  
[gulp-rename](https://www.npmjs.com/package/gulp-rename)  
[gulp-uncss](https://www.npmjs.com/package/gulp-uncss)  

**Tasks**
```javascript
//Styles: CSS  Minificado
gulp.task('styles', ['build:styles'], function() {
    gulp.start('uncss');
});
gulp.task('build:styles', function(){
  return gulp.src(config.styles.main)
  .pipe(sass().on('error', sass.logError))
  .pipe(autoprefixer('last 2 version'))
  .pipe(gulp.dest(config.styles.app))
  .pipe(rename({ suffix: '.min' }))
  .pipe(minifycss())
  .pipe(gulp.dest(config.styles.app));
});
// Optimiza styles.min.css
gulp.task('uncss', function() {
  return gulp.src(config.styles.app + '/style.min.css')
  .pipe(uncss({
    html: ['index.html', 'app/**/*.html']
    }))
  .pipe(gulp.dest(config.styles.output))
  .pipe(gulp.dest(config.styles.app));
});
```
**Watch & reload**
```javascript
gulp.watch(config.styles.watch, ['styles'], reload);
```

##Scripts
[gulp-uglify](https://www.npmjs.com/package/gulp-uglify)  
[gulp-jshint](https://www.npmjs.com/package/gulp-jshint)  
[gulp-concat](https://www.npmjs.com/package/gulp-concat)  

**Tasks**
```javascript
// Scripts: todos los archivos JS concatenados en uno solo minificado
gulp.task('scripts', function() {
  return gulp.src([config.scripts.app+'/js/*.js'])
  .pipe(jshint('.jshintrc'))
  .pipe(jshint.reporter('default'))
  .pipe(concat('main.js'))
  .pipe(rename({ suffix: '.min' }))
  .pipe(uglify())
  .pipe(gulp.dest(config.scripts.output))
  .pipe(gulp.dest(config.scripts.app));
});
```
**Watch & reload**
```javascript
gulp.watch(config.scripts.watch, ['scripts'], reload);
```

##Images
[gulp-imagemin](https://www.npmjs.com/package/gulp-imagemin)  
[imagemin-pngquant](https://www.npmjs.com/package/imagemin-pngquant)  
[gulp-cache](https://github.com/jgable/gulp-cache)  
[del](https://www.npmjs.com/package/del)  
**Tasks**
```javascript
// Images
gulp.task('images', ['build:images'], function() {
  gulp.start('clean:images');
});
gulp.task('build:images', ['copy:images'], function() {
  return gulp.src(config.images.main)
  .pipe(cache(imagemin({
    optimizationLevel: 3,
    progressive: true,
    interlaced: true,
    use: [pngquant()]
  })))
  .pipe(gulp.dest(config.images.app))
  .pipe(gulp.dest(config.images.output));
});
gulp.task('copy:images', function() {
  return gulp.src(config.images.app + '/*.*')
  .pipe(gulp.dest(config.images.output));
});
gulp.task('clean:images', function(cb) {
  del(config.images.main + '/*.*', cb);
});
```
**Watch & reload**
```javascript
gulp.watch(config.images.watch, ['images'], reload);
```
{'fraction_non_alphanumeric': 0.21226676519490117, 'fraction_numerical': 0.0025863661555514503, 'mean_word_length': 3.881424706943192, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 26, 'lorem ipsum': 0, 'www.': 26, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7401053', 'n_tokens_mistral': 4110, 'n_tokens_neox': 3986, 'n_words': 637}