Custom JS not being copied into dist

Hello,

I’ve added a new JS file within assets, & added the below within the manifest.json:

"semantic-ui.js": [
  "scripts/semantic-ui.js"
 ],

Also enqueued the script within setup.php:

wp_enqueue_script('sage/semantic-ui_js', Assets\asset_path('scripts/semantic-ui.js'), ['sage/js'], null, true);

But the JS isn’t copied over when I run gulp? The reference to the js in the page is ok.

Can anyone help please.

Thanks, Stephen

Please look over manifest.json and confirm that you’re using the correct syntax; it looks like yours is slightly off.

Thanks CFX,

I originally used;

"semantic-ui.js": {
  "files": [
    "scripts/semantic-ui.js"
  ]
},

Which worked ok but it’s being sent through the jshint and throwing lots of compiling js errors and ends the build process.

What’s the correct way to add a custom script that doesn’t get jshint checked and is just compressed?

Many thanks, Stephen

Which worked ok but it’s being sent through the jshint and throwing lots of compiling js errors and ends the build process.

You may need to alter your JSHint config depending on the errors you’re seeing. Also, if scripts/semantic-ui.js is already minified then you may end up with nasty errors/output; best to use an unminified source file.

What’s the correct way to add a custom script that doesn’t get jshint checked and is just compressed?

Just cut it out of your gulp workflow entirely and enqueue it as you would any other script.