Closed marian-r closed 8 years ago
Hi @marian-r, thanks for this changes. However, I'm getting an error when trying to build with your edited version of gruntfile.js:
Verifying property uglify.generated exists in config...ERROR
>> Unable to process task.
Warning: Required config property "uglify.generated" missing. Use --force to continue.
Would you be able to explain why this is happening?
Do you have everything installed properly - Grunt, Node packages?
Yes, I have all of those installed and working. First I used
yo backbone
to start the app but I was getting the conflict with usemin and requirejs when doing the build with grunt. I found your solution and then changed my gruntfile.js as per your file, removed the usemin block comments around the
<script data-main="scripts/main" src="bower_components/requirejs/require.js"></script>
in index.html
and tried to build again
Have you copied all my changes to your Gruntfile?
I tried your workflow and it is working. Make sure you copied all the changed blocks especially the last one - build workflow. Also don't forget to remove one '%' character for config variables, i.e. <%%= yeoman.app %>
-> <%= yeoman.app %>
.
Thanks @marian-r for looking into it. This is my gruntfile.js and I can't see anything wrong with it: https://gist.github.com/rszczypka/b1eee1acb83774f9a30b
Maybe the problem is somewhere else. I am able to build without problem when I comment out the line
uglify:generated
from the build task and the output looks all right so I won't worry about this any more.
Thank you for you help!
Your Gruntfile works for me. Maybe one more thing you can do is to send me the verbose output from grunt build grunt build --verbose
.
There are a couple additional changes that need to be made for this to work with CoffeeScript—specifially, building the CoffeScript files into a separate temporary directory, then loading the main module from that location during the RequireJS step. In Gruntfile
, in the coffee:dist
configuration:
- dest: '.tmp/scripts',
+ dest: '.tmp/coffee/scripts',
and in the requirejs:dist
configuration:
- mainConfigFile: '<%= yeoman.app %>/scripts/main.js', // contains path specifications and nothing else important with respect to config
+ paths: {'main': '../../.tmp/coffee/scripts/main'},
+ mainConfigFile: '.tmp/coffee/scripts/main.js', // contains path specifications and nothing else important with respect to config
Actually, even better: instead of changing the CoffeeScript build output directory, change the requirejs:dist
build output directory (dir
) to .tmp/requirejs/scripts
, and point uglify:dist
to the main.js
file there instead of in .tmp/scripts
. Changing the CoffeeScript build output directory breaks grunt serve
.
Thanks for working on this fix. Looks like this is the first move to resolving https://github.com/yeoman/generator-backbone/pull/299 and https://github.com/yeoman/generator-backbone/pull/296, which resolves the out of the box bug preventing us from using a recent version of usemin. Looking forward to seeing this make it to master.
I am a little bit surprised why the maintainers of this repo are not trying to make Grunt build working. But maybe my fix is not working for some scenarios which I didn't test.
In the meantime, you can try to use this fix by yourself.
Hey y'all! Please merge re: https://github.com/yeoman/grunt-usemin/issues/112
This needs a rebase.
Am I suppose to do it, or you are? I am not sure what you mean.
You are.
I've done the rebase. Please check if it's OK as I've done it for the first time.
Looks good :).
Any progress?
I'm not really using this so I'm not the right one to test, but if someone else could and confirm it's working I'll be happy to merge.
I'm not really using this so I'm not the right one to test, but if someone else could and confirm it's working I'll be happy to merge.
@kevva I'm not the right one eighter and I don't think many of us (if any) uses generator-backbone extensively. The build system is broken in many ways and I saw people complaining about it on IRC already...
We don't have an active maintainer for this repo so we should probably discuss opening such a "call for a maintainer" issue.
Call for a maintainer or find a community alternative that we can deprecate this in favor of.
Call for a maintainer or find a community alternative that we can deprecate this in favor of.
Totally :+1:!
I'm :+1: call for a maintainer
What about replacing RequireJS with almond for app in production? This config works for me. R.js combines everything to one file in .tmp directory and uglify then minifies and moves the file to dist. Just, I've not tested it with CoffeScript, since I don't work with it.