Skip to content

App JS files are not concatenated via usemin task #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eikaramba opened this issue Oct 31, 2014 · 3 comments
Closed

App JS files are not concatenated via usemin task #675

eikaramba opened this issue Oct 31, 2014 · 3 comments

Comments

@eikaramba
Copy link

hello there, first of all i want to say this might be related to this issue #627.

Now my problem is somehow a little bit different. Normally fullstack works fine, and i have used in on mutliple projects. But this time (i don't know why) the usemin task is not able to minify/concatenate etc. the app js files(at the bottom of the index.html). Everything else works (e.g. when usemin concatenates the vendor files one block before the app js files).
Hint: Useminprepare works, it finds the files and generates the appropiate subtasks with a valid config (e.g. concatenate)

after hours searching i found the problem. it is the injector:scripts task. Commenting this task out and usemin is able to do its work. however only after i manually saved the file again(i'm using SublimeText)

So i compared the files in beyondcompare. The original html file, where usemin works and the one that was processed by injector that does not work. There is no difference, only when you compare the hex values.

snap 2014-10-31 at 16 08 23

I will now continue to look how to fix this. I guess it might somehow have something to do that i'm on windows. However, all the other projects are working and there i'm also using windows.

@eikaramba
Copy link
Author

Got it! :)

Okay the problem are indeed the line endings. see http://stackoverflow.com/questions/23895397/grunt-usemin-doesnt-affect-the-html-fileindex-html and klei/grunt-injector#8. For this use case the author of injector provides a configurable option for line endings.

I'm not sure whether this will impact my deployment to a unix server (as now the index.html has windows line endings), but even then one can use something like https://www.npmjs.org/package/grunt-eol to transform the line endings as a last task.

So the final solution is to have
var os = require('os');
and the beginning of your grunfile as well as
injector: {
options: {
lineEnding: os.EOL
},
.......
to use the right line endings usemin can handle.

@kingcody
Copy link
Member

kingcody commented Nov 2, 2014

@eikaramba that seemed to be the issue in #491. See my last comment there. What are your thoughts on jscs usage for correcting line endings? Btw, the canary branch already has grunt-jscs implemented.

@eikaramba
Copy link
Author

yeah i looked at jscs and as fas as i can tell although it is included as a task in the canary branch it is not used there. However apart from that i'm not sure whether jscs might actually help solve the problem, because usemin will always generate "wrong" lineEndings without the option and jscs might only help to notify about that or if i already use the wrong lineEndings in my editor. But i have to admit i'm not 100% sure why this lineEnding problem is occurring on this one project at all (again i had never issues using usemin on windows)

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

No branches or pull requests

2 participants