gulp-usemin icon indicating copy to clipboard operation
gulp-usemin copied to clipboard

Output html directory stripped

Open thany opened this issue 8 years ago • 0 comments

This is my structure, as far as this issue is concerned:

- gulpfile.js
- includes
- - php
- - - bottom.php
- - js
- - - default.js
- node_modules
- - blissfuljs
- - - bliss.js

And my code block (in bottom.php):

<!-- build:mainjs includes/js/app.js -->
<script src="node_modules/blissfuljs/bliss.js"></script>
<script src="includes/js/default.js"></script>
<!-- endbuild -->

And my gulp task:

gulp.task("js:dist", [ "clean:dist" ], function() {
  return gulp.src( "includes/php/bottom.php")
    .pipe(usemin({
      path: ".",
      mainjs: [ sourcemaps.init(), "concat", sourcemaps.write(".") ],
    }))
    .pipe(gulp.dest("dist"));
});

What actually happens:

- dist
- - bottom.php
- - includes
- - - js
- - - - app.js

What should happen:

- dist
- - includes
- - - php
- - - - bottom.php
- - - js
- - - - app.js

Basically, in the output stream, the source file includes/php/bottom.php is stripped to just bottom.php. This causes it to be written to the root of the directory passed to gulp.dest(). I couldn't find any combination of options to force it back into the correct directory.

  • Replacing path: "." with assetsDir: "." changes absolutely nothing.
  • Adding assetsDir: "." causes usemin to search 2 directories up for scripts???
  • Adding outputRelativePath: "includes/php" causes the destination script file to become includes\php\includes\js\app.js and changes nothing for bottom.php.

So, I don't know how tell usemin what I want. It really does seem like a bug to me, the fact that the output html filename is altered, and cannot be corrected in any way.

  • Node 8.2.1
  • NPM 5.3.0
  • Gulp 3.9.1
  • Usemin 0.3.28

thany avatar Jul 23 '17 01:07 thany