]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Merge branch 'develop' into fix/fix-es6-plugins-webpack-build-2
authorNicolas Coden <nicolas@ncoden.fr>
Tue, 20 Mar 2018 22:11:28 +0000 (23:11 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Tue, 20 Mar 2018 22:11:28 +0000 (23:11 +0100)
1  2 
gulp/config.js
gulp/tasks/javascript.js
js/foundation.toggler.js
js/foundation.tooltip.js

diff --cc gulp/config.js
Simple merge
index 51bc590f0137021b8134b160b2938af7c749e641,d30607908c74e1d42ee3e667e883a8d826fd785d..a2070869d8403d4a76cace28635e825d9847ed57
@@@ -6,13 -6,14 +6,14 @@@ var rename = require('gulp-rename')
  var webpackStream = require('webpack-stream');
  var webpack2 = require('webpack');
  var named = require('vinyl-named');
+ var sourcemaps = require('gulp-sourcemaps');
  
 +var utils = require('../utils.js');
  var CONFIG = require('../config.js');
  
 -// Compiles JavaScript into a single file
 -gulp.task('javascript', ['javascript:foundation', 'javascript:deps', 'javascript:docs']);
 -
 -// NOTE: This sets up all imports from within Foundation as externals, for the purpose
 +// ----- WEBPACK CONFIGURATION -----
 +//
 +// The following sets up all imports from within Foundation as externals, for the purpose
  // of replicating the "drop in dist file" approach of prior versions.
  // THIS IS NOT RECOMMENDED FOR MOST USERS. Chances are you either want everything
  // (just throw in foundation.js or foundation.min.js) or you should be using a build
@@@ -67,43 -56,53 +68,51 @@@ var webpackConfig = 
      ]
    },
    output: {
 -    // ---
 -    // FIXME: to resolve before the next release
 -    // Temporary disable UMD bundling, waiting for a way to import plugins are externals
 -    // See https://github.com/zurb/foundation-sites/pull/10903
 -    // ---
 -    // libraryTarget: 'umd',
 +    libraryTarget: 'umd',
-   }
+   },
+   // https://github.com/shama/webpack-stream#source-maps
+   devtool: 'source-map'
  }
  
 +// ----- TASKS -----
 +//
 +
 +// Compiles JavaScript into a single file
 +gulp.task('javascript', ['javascript:foundation', 'javascript:deps', 'javascript:docs']);
 +
  // Core has to be dealt with slightly differently due to bootstrapping externals
 -// and the dependency on foundation.util.core
 +// and the dependency on foundation.core.utils
  //
  gulp.task('javascript:plugin-core', function() {
    return gulp.src('js/entries/plugins/foundation.core.js')
      .pipe(named())
 -    .pipe(webpackStream(webpackConfig, webpack2))
+     .pipe(sourcemaps.init())
 +    .pipe(webpackStream(Object.assign({}, webpackConfig, {
 +        output: webpackOutputAsExternal,
 +      }), webpack2))
+     .pipe(sourcemaps.write('.'))
      .pipe(gulp.dest('_build/assets/js/plugins'));
  });
  gulp.task('javascript:plugins', ['javascript:plugin-core'], function () {
    return gulp.src(['js/entries/plugins/*.js', '!js/entries/plugins/foundation.core.js'])
      .pipe(named())
 -    .pipe(webpackStream(Object.assign({}, webpackConfig, { externals: pluginsAsExternals }), webpack2))
+     .pipe(sourcemaps.init())
 +    .pipe(webpackStream(Object.assign({}, webpackConfig, {
 +        externals: webpackExternalPlugins,
 +        output: webpackOutputAsExternal,
 +      }), webpack2))
+     .pipe(sourcemaps.write('.'))
      .pipe(gulp.dest('_build/assets/js/plugins'));
  });
  
  gulp.task('javascript:foundation', ['javascript:plugins'], function() {
    return gulp.src('js/entries/foundation.js')
      .pipe(named())
+     .pipe(sourcemaps.init())
      .pipe(webpackStream(webpackConfig, webpack2))
+     .pipe(sourcemaps.write('.'))
      .pipe(gulp.dest('_build/assets/js'));
  });
 -//gulp.task('javascript:foundation', function() {
 -//  return gulp.src(CONFIG.JS_FILES)
 -//    .pipe(babel()
 -//      .on('error', onBabelError))
 -//    .pipe(gulp.dest('_build/assets/js/plugins'))
 -//    .pipe(concat('foundation.js'))
 -//    .pipe(gulp.dest('_build/assets/js'));
 -//});
  
  gulp.task('javascript:deps', function() {
    return gulp.src(CONFIG.JS_DEPS)
Simple merge
Simple merge