cgross / generator-cg-angular

Yeoman generator for Enterprise Angular projects.
MIT License
592 stars 198 forks source link

Empty js file when grunt build #21

Closed ruben-podadera closed 10 years ago

ruben-podadera commented 10 years ago

Hello,

My project requires to have all files as absolutes url in the index.html

...
<!-- Main App JS -->
<script src="/js/setup.js"></script>

<!-- Controllers -->
<script src="/js/controller/app-menu.js"></script>
<script src="/js/controller/message.js"></script>
...

Since I have done that :

➜  frontend git:(develop) ✗ grunt build
...
Done, without errors.
➜  frontend git:(develop) ✗ ls -l dist 
total 12
-rw-rw-r-- 1 ruben ruben    0 Mar 28 13:02 app.full.min.js
drwxrwxr-x 4 ruben ruben 4096 Mar 28 13:02 bower_components
drwxrwxr-x 2 ruben ruben 4096 Mar 28 13:02 css
-rw-rw-r-- 1 ruben ruben 1149 Mar 28 13:02 index.html

If I remove the heading slash for all files in the index.html, the app.full.min.js is sucessfully generated (but then I got some javascript errors when using the app)

Any one had the same issue?

Regards,

Ruben

cgross commented 10 years ago

Hmm. I haven't see this problem. Are you using isPath:true? If you don't use that option, then you'll pass the path as is to the concat/min tasks and they'll see the path as absolute to the file system.

If that's not it, can you post your Gruntfile.js.

cgross commented 10 years ago

Ah just realized this was posted in the generator project and not in the dom_munger project. So yes, please add isPath:true to your dom_munger read tasks. So it should look something like this:

      read: {
        options: {
          read:[
            {selector:'script[data-build!="exclude"]',attribute:'src',writeto:'appjs',isPath:true},
            {selector:'link[rel="stylesheet"]',attribute:'href',writeto:'appcss',isPath:true}
          ]
        },
        src: 'index.html'
      },
cgross commented 10 years ago

Clean up some issues. If you're still having problems, please reopen with details.