|
@@ -2,6 +2,7 @@
|
|
|
var gulp = require("gulp");
|
|
|
var webpack = require('webpack');
|
|
|
var webpackStream = require("webpack-stream");
|
|
|
+var path = require("path");
|
|
|
var processShaders = require("../helpers/gulp-processShaders");
|
|
|
var uncommentShaders = require('../helpers/gulp-removeShaderComments');
|
|
|
|
|
@@ -16,6 +17,7 @@ gulp.task("watch", function startWatch() {
|
|
|
|
|
|
config.modules.map(function(module) {
|
|
|
var settings = config[module].build;
|
|
|
+ var isCore = config[module].isCore;
|
|
|
if (settings && settings.webpack) {
|
|
|
for (var index = 0; index < config[module].libraries.length; index++) {
|
|
|
var library = config[module].libraries[index];
|
|
@@ -23,22 +25,32 @@ gulp.task("watch", function startWatch() {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- let wpconfig = require(settings.webpack);
|
|
|
+ let wpConfig = require(settings.webpack);
|
|
|
// watch on.
|
|
|
- wpconfig.watch = true;
|
|
|
+ wpConfig.watch = true;
|
|
|
// dev mode and absolute path sourcemaps for debugging
|
|
|
- wpconfig.mode = "development";
|
|
|
- wpconfig.devtool = "nosources-source-map";
|
|
|
- wpconfig.output.devtoolModuleFilenameTemplate = (info) => {
|
|
|
- return `${info.resourcePath}`.replace('Tools/Gulp/../../', '');
|
|
|
+ wpConfig.mode = "development";
|
|
|
+ wpConfig.devtool = "nosources-source-map";
|
|
|
+
|
|
|
+ var rootPath = path.resolve(__dirname, "../../../");
|
|
|
+ var absoluteSrc = path.resolve(__dirname, "../", settings.srcDirectory);
|
|
|
+ var prefix = isCore ? "../" : "../../";
|
|
|
+ wpConfig.output.devtoolModuleFilenameTemplate = (info) => {
|
|
|
+ info.resourcePath = path.normalize(info.resourcePath);
|
|
|
+
|
|
|
+ if (!path.isAbsolute(info.resourcePath)) {
|
|
|
+ info.resourcePath = path.join(absoluteSrc, info.resourcePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ return `${prefix}${path.relative(rootPath, info.resourcePath).replace(/\\/g, "/")}`;
|
|
|
};
|
|
|
|
|
|
var outputDirectory = config.build.tempDirectory + settings.distOutputDirectory;
|
|
|
- tasks.push(webpackStream(wpconfig, webpack).pipe(gulp.dest(outputDirectory)))
|
|
|
+ tasks.push(webpackStream(wpConfig, webpack).pipe(gulp.dest(outputDirectory)))
|
|
|
|
|
|
tasks.push(gulp.src(settings.srcDirectory + "**/*.fx")
|
|
|
.pipe(uncommentShaders())
|
|
|
- .pipe(processShaders(config[module].isCore))
|
|
|
+ .pipe(processShaders(isCore))
|
|
|
);
|
|
|
|
|
|
tasks.push(
|
|
@@ -46,7 +58,7 @@ gulp.task("watch", function startWatch() {
|
|
|
console.log(library.output + ": Shaders.");
|
|
|
gulp.src(settings.srcDirectory + "**/*.fx")
|
|
|
.pipe(uncommentShaders())
|
|
|
- .pipe(processShaders(config[module].isCore));
|
|
|
+ .pipe(processShaders(isCore));
|
|
|
})
|
|
|
);
|
|
|
}
|