2015-06-01 36 views
6

Impalcato un'applicazione web Yeoman con gulp-angular.Come eseguire il gulp di build index.html di riferimento con percorsi assoluti?

mio processo gulp build genera un file dist/index.html che fa riferimento a beni utilizzando percorsi relativi:

<html> 
    <head> 
    ... 
    <link rel="stylesheet" href="styles/vendor-f57bbe49.css"> 
    <link rel="stylesheet" href="styles/app-a0b8907b.css"> 
    </head> 
    <body> 
    ... 
    <script src="scripts/vendor-a30f25be.js"></script> 
    <script src="scripts/app-b7f411d9.js"></script> 
    </body> 
</html> 

Come forzo Gulp utilizzare percorsi assoluti invece?

E.g. /scripts/ invece di scripts/ e /styles/ invece di styles/

Ecco un estratto del mio attuale src/index.html:

<html> 
    <head> 
    ... 
    <!-- build:css({.tmp/serve,src}) styles/vendor.css --> 
    <link rel="stylesheet" href="app/vendor.css"> 
    <!-- bower:css --> 
    <!-- run `gulp inject` to automatically populate bower styles dependencies --> 
    <!-- endbower --> 
    <!-- endbuild --> 

    <!-- build:css({.tmp/serve,src}) styles/app.css --> 
    <!-- inject:css --> 
    <!-- css files will be automatically insert here --> 
    <!-- endinject --> 
    <!-- endbuild --> 
    </head> 
    <body> 
    ... 
    <!-- build:js(src) scripts/vendor.js --> 
    <!-- bower:js --> 
    <!-- run `gulp inject` to automatically populate bower script dependencies --> 
    <!-- endbower --> 
    <!-- endbuild --> 

    <!-- build:js({.tmp/serve,.tmp/partials,src}) scripts/app.js --> 
    <!-- inject:js --> 
    <!-- js files will be automatically insert here --> 
    <!-- endinject --> 
    </body> 
</html> 

risposta

3

semplicemente cambiare i percorsi dei file specificati nelle <!-- build: ... --> commenti; Gulp li usa esplicitamente per costruire i suoi obiettivi!

<html> 
    <head> 
    ... 
    <!-- build:css({.tmp/serve,src}) /styles/vendor.css --> 
    <link rel="stylesheet" href="app/vendor.css"> 
    <!-- bower:css --> 
    <!-- run `gulp inject` to automatically populate bower styles dependencies --> 
    <!-- endbower --> 
    <!-- endbuild --> 

    <!-- build:css({.tmp/serve,src}) /styles/app.css --> 
    <!-- inject:css --> 
    <!-- css files will be automatically insert here --> 
    <!-- endinject --> 
    <!-- endbuild --> 
    </head> 
    <body> 
    ... 
    <!-- build:js(src) /scripts/vendor.js --> 
    <!-- bower:js --> 
    <!-- run `gulp inject` to automatically populate bower script dependencies --> 
    <!-- endbower --> 
    <!-- endbuild --> 

    <!-- build:js({.tmp/serve,.tmp/partials,src}) /scripts/app.js --> 
    <!-- inject:js --> 
    <!-- js files will be automatically insert here --> 
    <!-- endinject --> 
    </body> 
</html> 
Problemi correlati