Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

JavaScript Concatenation? #41

Closed
prime31 opened this issue Mar 27, 2018 · 4 comments
Closed

JavaScript Concatenation? #41

prime31 opened this issue Mar 27, 2018 · 4 comments

Comments

@prime31
Copy link

prime31 commented Mar 27, 2018

The README says:

The main idea is to recreate the famous Ruby on Rails Asset Pipeline, which minifies, concatenates and fingerprints the assets used in your website.

I can't seem to figure out how to get JavaScript concatenation working. Compressing and fingerprinting are working fine but not concatenation. Is there something undocumented that allows this?

@jbrodriguez
Copy link
Owner

If you're using the default .hugulprc, try putting your js files in assets/scripts.

Does that work ?

@prime31
Copy link
Author

prime31 commented Mar 27, 2018

That is what I was doing and it just seems to jslint the files and copy them in static/scripts but not concat them.
screen shot 2018-03-27 at 2 06 48 pm

@jbrodriguez
Copy link
Owner

You know what, you're absolutely right.

In watch mode, it does jshint only.

In build mode, It's uglifying each individual file, but it's not concatenating it.

I'll probably have some time to fix it by the weekend.

It's a small change

    .pipe(uglify())
+   .pipe(concat('scripts.js'))
    .pipe(size({ title: 'scripts: ' }))

right around here

https://github.com/jbrodriguez/hugulp/blob/master/gulp/build.js#L91

@prime31
Copy link
Author

prime31 commented Mar 27, 2018

Bingo. Works like a champ! Thanks! If I wasnt such a Node/Gulp newbie I would have found that myself! I assume that this will just concat in filename order.

Totally unrelated but it would be a pretty nice feature to be able to have it work like scss files: an underscore in the filename ignores it and then a script with includes makes ordering the files nice and simple.

@prime31 prime31 closed this as completed Mar 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants