Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Clean flag for builds #977
I know in this question on stack overflow one of the brunch contributors suggested using
The last seems to fit best with the brunch approach and would fit well with watch. So for example, I could rename an asset and
I'm kinda reluctant to this. More flags, more complication.
What is your exact use case? Why not just use
For example, packing the result with Cordova. Or similar.
I'm not familiar enough with Cordova to understand why cleaning would be a problem with it. I would think most workflows would want extra files (like old assets etc) in the public directory cleaned up to prevent them from being deployed. I guess if brunch was being used as part of a larger build process with grunt/gulp/etc that was putting other files into public/ you might not want those deleted, even then, I would think you would want them rebuilt.
I'm a .NET developer who was considering switching an AngularJS project that someone else setup for me using yeoman and grunt to brunch. Within the first 5 minutes of using brunch, I realized it wasn't cleaning up files and didn't have an option for doing this. I found this when I had messed up my config and was outputting my js file to the wrong location. After fixing the config, I found the old js file hadn't been cleaned up. This can also happen when renaming or removing assets etc. I think most build tools have some support for either a clean build or for cleaning up extraneous files since it is a common issue when building. Indeed the
Perhaps I am missing something, but I thought it would be pretty obvious to have some kind of clean support. All the tools brunch is compared to do.
Other tools have this as a necessary evil for when they can't make their workflows work without temp files. That's the main reason it's always a step for grunt anyway.
So Brunch hasn't needed it. But I think it would be ok to add the option.
In addition to a CLI switch it could be a config option to just cause it to happen every time without thinking about it if a project chooses.
I'm the OP of the related SO question and I'm not a big fan of the proposed solution.
Another option will be to create a
then imagine i update the config so now
in config, you can have a new option
if there's no
this can be added as default because it will not affect current projects because it only touches brunch generated files.
I don't know if it's worth having another file
side-effect bonus: this brunch-output will also serve as a debugging tool, you get to clearly see which files were created by brunch.
+1 for a cleanup step. The config setting seems like a good idea.
I can't help but wonder why isn't this a feature already. Has no one thought of removing source maps for production builds?! That's what led me to this issue, and I'm just scraping together my first ever Brunch config here!
changed the title from
Should support clean or automatically clean up output
Clean flag for builds
Dec 14, 2015
@ysle no, we have not worked on this yet, but we will eventually
Implementation wise, adding an artifact file (where to? root? public?) might not be the cleanest solution, but then, there doesn't seem to be a different option for tracking which files were produced by brunch and which were not.
Should the cleaning happen only during initial start and not through the run time of watch?
Also, this will still leave files in public generated by brunch plugins (in