drioemgaoin / GulpMainNpmFiles

MIT License
9 stars 9 forks source link

Override is not working. #5

Open myplaneticket opened 7 years ago

myplaneticket commented 7 years ago

I have the following overrides (below), which doesn't seem to be working.

 "dependencies": {
    "animate.css": "^3.5.2",
    "bootstrap": "^4.0.0-beta.2",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "jquery-lazy": "^1.7.5",
    "jquery-slimscroll": "^1.3.8",
    "jquery-ui": "^1.12.1",
    "legit-ripple": "^1.1.0",
    "pace-js": "^1.0.2",
    "popper.js": "^1.12.5",
    "throttle-debounce": "^1.0.1"
  },

  "overrides": {
    "bootstrap": {
      "main": [
        "dist/js/bootstrap.js"
      ]
    },
    "animate.css": {
      "main": "animate.css"
    },
    "font-awesome": {
      "main": [
        "fonts/*"
      ]
    },
    "jquery-slimscroll": {
      "main": "jquery.slimscroll.js"
    },
    "siriwavejs": {
      "main": "siriwave.js"
    },
    "annyang": {
      "main": "dist/annyang.js"
    }
  }

BUILD FILE:

var gulp = require('gulp'),
    cssnano = require('gulp-cssnano'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    flatten = require('gulp-flatten'),
    gulpFilter = require('gulp-filter'),
    mainNpmFiles = require('gulp-main-npm-files'),
    config = require('../config');

gulp.task('copy-npm-files', function() {
  var jsFilter = gulpFilter(['*.js', '!*.min.js', '!index.js', '!test.js', '!gulpfile.js'], {restore: true}),
      cssFilter = gulpFilter(['*.css', '!*.min.css'], {restore: true}),
      fontFilter = gulpFilter(['*.otf, *.eot', '*.woff', '*.woff2', '*.svg', '*.ttf'], {restore: true});

  return gulp.src(mainNpmFiles())
    // grab vendor js files from node_modules, minify and push in /public
    .pipe(jsFilter)
    .pipe(gulp.dest(config.paths.path_vendor + '/js/'))
    .pipe(uglify())
    .pipe(rename({
      suffix: ".min"
    }))
    .pipe(gulp.dest(config.paths.path_vendor + '/js/'))
    .pipe(jsFilter.restore)
    // grab vendor css files from node_modules, minify and push in /public
    .pipe(cssFilter)
    .pipe(gulp.dest(config.paths.path_vendor + '/css/'))
    .pipe(cssnano())
    .pipe(rename({
        suffix: ".min"
    }))
    .pipe(gulp.dest(config.paths.path_vendor + '/css/'))
    .pipe(cssFilter.restore)
    // grab vendor font files from node_modules and push in /public
    .pipe(fontFilter)
    .pipe(flatten())
    .pipe(gulp.dest(config.paths.fonts_path_dist));
});
cyntss commented 6 years ago

this would make a lot of sense, specially for bootstrap

Suguru-Tokuda commented 4 years ago

I have the same issue with bootstrap. It just looks at /dist/js/bootstrap (specified for main), filtering doesn't work.