Closed DavidMoore closed 10 years ago
An overwrite will only happen if your output directory is the same as your input directory. All examples and demos (and our experience) use a separated output dir, so this is not an issue.
What is more, if we change the name of the main file, we will also need to change the name in the html file that reference it. Keeping the names intact, allows us to run the app with and without optimisation from either directory without the need to manage the html file content.
Also, if we decide it is better to use main-built.js for the output then it needs to be changed also as the default output name, not just in the docs...
Hello
In my personal experience, once I finally got the instructions working, using the example gulpfile, I obviously got my main.js overwritten with the built one. I'm surprised this hasn't happened to anyone else.
Previously using Weyland, and earlier build solutions for Durandal, the conventions were to have main-built.js output next to main.js.
So, the risk in having the same filename for input and output is that the input is going to get overwritten by the output; this is avoided by having different filenames and following the original Durandal convention.
It's not necessary to change the default to main-built.js; my change is to alter the example to prevent idiots like myself that try to get Durandal building as it was with Weyland, to make the transition as seamless as possible ;)
(That's why I removed the comment saying it's the default, as main.js remains the default at this stage).
I wouldn't bother if you don't think this has impacted many people. Personally I'm just relieved I've finally got Durandal building again after spending a day wrestling with npm, gulp and gulp-durandal. Was hoping to spare any others some of the same pain.
David,
Thanks you for the input.
The issue you raised is valid and needs to be addressed since it might cause people to loose code, even if not in all cases.
We will try to find a programatic solution for that so that we ensure no files/code is accidentally deleted. If we do not find a solution in a few days, we will fallback to changing the docs, as per your suggestion.
You will hear from us soon.
Hi again. Thanks for the response. I think a programmatic solution would be great, but I would put it on a low priority. I think if you'd prefer to keep the defaults as they are, perhaps we can just alter the documentation to warn about the risk of overwrites if the output directory is the same as the input, and the input and output filenames are the same. I'd be happy to close this ticket, and open another pull request with a small note / warning added to the docs.
great. lets do as you as you suggest.
On Thu, Jul 3, 2014 at 10:46 AM, David Moore notifications@github.com wrote:
Hi again. Thanks for the response. I think a programmatic solution would be great, but I would put it on a low priority. I think if you'd prefer to keep the defaults as they are, perhaps we can just alter the documentation to warn about the risk of overwrites if the output directory is the same as the input, and the input and output filenames are the same. I'd be happy to close this ticket, and open another pull request with a small note / warning added to the docs.
— Reply to this email directly or view it on GitHub https://github.com/welldone-software/gulp-durandal/pull/5#issuecomment-47876507 .
Updated readme in version 1.1.5.
Setting the output to "main.js" will mean that the input "main.js" will then get overwritten by the built, minified output file. Changed to main-built.js as per usual Durandal convention.