STARTER.libraries.yml points to "js/scripts.js" instead of "js/js-src/scripts.js"

CommentFileSizeAuthor
#18 fixed-watch-js-path.patch695 bytesFiNeX
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ahwebd created an issue. See original summary.

kevinquillen’s picture

This is because the Gulpfile will minify/compress that file to js/scripts.js when ran.

I don't think it is necessarily a bug.

ahwebd’s picture

this leads us to discover a misplacement of directory js-src in starter subtheme, it should be placed in STARTER directory instead of STARTER /js (alternatively we can make path adjustments in Gulpfile.js)

kevinquillen’s picture

What is the issue again here exactly? That the file doesn't exist until you run Gulp?

ahwebd’s picture

Gulp does not process js, because the path given to gulp.src is './js-src/*.js' but this path does not exist.

kevinquillen’s picture

My bad. I have pushed a fix to dev.

/**
 * This task minifies javascript in the js/js-src folder and places them in the js directory.
 */
gulp.task('compress', function() {
  return gulp.src('./js/js-src/*.js')
    .pipe(sourcemaps.init())
    .pipe(uglify())
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest('./js'))
    .pipe(notify({
      title: "JS Minified",
      message: "All JS files in the theme have been minified.",
      onLast: true
    }));
});
kevinquillen’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

FiNeX’s picture

Status: Closed (fixed) » Active

Hi, probably something went wrong because the bug is not yet fixed, I've tested both -dev and stable release, the path on Gulpfile.js is still wrong.

Thanks.

kevinquillen’s picture

Assigned: Unassigned » kevinquillen
Status: Active » Needs work
kevinquillen’s picture

kevinquillen’s picture

FiNeX, I have reviewed the Gulpfile and it it appears to contain the changes mentioned above.

After running gulp or gulp compress, it should generate a scripts.js file in subtheme/js/scripts.js. I just tried it with 8.x-1.x-dev and a fresh subtheme.

FiNeX’s picture

Ok, thanks!

kevinquillen’s picture

Just to clarify, that is the generated, uglified output of js/js-src/*.js. That is what you would edit.

kevinquillen’s picture

Status: Needs work » Fixed
kevinquillen’s picture

FiNeX’s picture

Status: Fixed » Active

Hi Kevin.
I've re-checked the 8.x-1.x-dev. The "compress" task is ok. The "watch" task still contains a wrong path.

The current code is:
gulp.watch(['js-src/**/*.js'], ['compress', 'drush:cc']);

It should be:
gulp.watch(['js/js-src/**/*.js'], ['compress', 'drush:cc']);

Thanks :-)

FiNeX’s picture

FileSize
695 bytes

Simple patch to -dev version.

  • kevinquillen committed e6640ce on 8.x-1.x authored by FiNeX
    Issue #2554581 by FiNeX, kevinquillen: wrong path to scripts.js in...

  • kevinquillen committed dd01729 on 7.x-1.x authored by FiNeX
    Issue #2554581 by FiNeX, kevinquillen: wrong path to scripts.js in...
kevinquillen’s picture

Huh weird, that seeped back into the repo somehow on both versions. I've changed both.

kevinquillen’s picture

Status: Active » Fixed
kevinquillen’s picture

kevinquillen’s picture

Further discussions on the js folder are happening here:

#2511612: Javascript doesn't have a source folder and gets minified

FiNeX’s picture

Thanks Kevin!

rovo’s picture

I had the same issue in neato 7.x-1.2+4-dev

#17 resolved the issue for me.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.