Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Conversation

EspadaV8
Copy link

This is in response to #66

This is my first nodejs change so I'm expecting it to need updating, it also removes some previous 'features' in the default instance.

Whatever is passed as the second parameter to version is now used, as-is, for the build path (no /build is appended). This allows the files to be created wherever someone might want them.

Only files that are defined within the rev-manifest.json file are deleted now. Since it's possible to put the files in any folder we can't just delete everything because things will go missing (as I learnt while developing this). This does mean that if you're using the default setup that empty folders won't get deleted, but it's highly likely they would just've been re-created anyway.

The duplicated app.css files that would be created by the versioning aren't cleaned up after the versioning. They aren't deleted at the start when deleting the pervious versioned files since it's possible that we wouldn't be deleting the duplicated file but the original.

Map files are only copied if the new location doesn't match the old location.

@JeffreyWay
Copy link
Contributor

Going to think on this a bit. Looks good, though!

@JeffreyWay
Copy link
Contributor

I want to merge this. But a couple things first.

If I do:

mix.version('public/js/all.js', 'public/output')

Currently that will give me: http://cl.ly/image/060O242m2T41

With your PR, I get: http://cl.ly/image/220O18253K3e

Notice that we have that issue again from a while ago, where the all.js gets copied over, along with the versioned one. Can you modify your PR to remove this, like we had?

Andrew Smith added 2 commits April 7, 2015 12:35
gulp-rev will create a copy of the original file, e.g. all.js while
creating the revisioned version all-ffffff.js. This now deletes both the
original file and the copy that gulp-rev creates
@EspadaV8 EspadaV8 force-pushed the feature/custom-build-dir branch from bb47ad0 to d6123cb Compare April 7, 2015 02:36
@EspadaV8
Copy link
Author

EspadaV8 commented Apr 7, 2015

I've updated the PR so that it cleans up a bit nicer in general.

The all.js file will be deleted from the original location, e.g. public/js/all.js since it shouldn't be needed there any more. It will also delete all.js from the build dir if that isn't the same as the original location.

.map files were also duplicated into the build folder, so they are deleted from the original location if there is a difference between the 2 folders.

This should mean that at the end of a version task the only files left would be buildDir + file and buildDir + file + '.map'.

@adamramadhan
Copy link

ah i see so this time it only delete the file that are in the rev. need this +1

@JeffreyWay
Copy link
Contributor

Fixed in a different PR, but thanks so much!

@JeffreyWay JeffreyWay closed this Jun 8, 2015
@renedekat
Copy link

Setting a custom build folder in Elixir is nice, but as long as the helper still has /build/ hardcoded, there really is no point.

@soltmar
Copy link

soltmar commented Feb 24, 2016

Is this something what are you working on ?

It will be really useful to have this feature without "build" hard-coded.

In my case I'm minifying/combining JS files so actually I have 3 copies of files:

  • original ones
  • combined/minified files
  • combined/minified versioned files

Plus if I will set minified scripts to land in "build" directory then it is overridden by version task which makes "build" empty directory


elixir(function(mix) {
    mix.scripts([
        "jquery.min.js",
        "jquery.mobile.min.js",
        "slick/slick.min.js",
        "../bootstrap/js/bootstrap.min.js",
        "custom.js"
    ],"public/build/combined.js", jsDir);
});

elixir(function(mix) {
    mix.version("public/build/combined.js");
});

@Squidies
Copy link

Squidies commented Apr 7, 2016

Right now the issue I'm running into is that my Vagrant box server root isn't laravels public dir so having /build/css/{whatever.css} isn't pointing to the versioned css file. Removing the preceding / or making it a relative path as ./ seems to fix it but I'm not sure of how to do have laravel do this properly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants