How should I configure grunt-usemin to work with relative path

前端 未结 9 1634
予麋鹿
予麋鹿 2021-01-30 23:13

I have a grunt project backed by a yeoman-generator that I\'ve built based on the generator-webapp, if it\'s of any help, you can find it on GitHub

The grunt project mak

9条回答
  •  一生所求
    2021-01-31 00:04

    I make the usemin blocks relative to the template.

    I have a structure like this:

    app/ - webroot source (devmode)
    app/views/layouts - layouts for server-generated pages (also has usermin tags init)
    app/js - source javascript
    
    dist/ - production build dir
    

    I make my html look like this in app/layouts/main.html:

        
          
          
          
        
    

    on dev (no usemin, just serving files) "../../" cleverly just resolves to "/", so it still works. This way you don't need to preprocess while you are developing (with watch tasks or whatever.)

提交回复
热议问题