2015-06-01 2 views
6

Scaffolded eine Yeoman Web-Anwendung mit gulp-angular.Wie schlucke ich Index-Referenz-Assets mit absoluten Pfaden?

Mein gulp build Prozess gibt ein dist/index.html-Datei, die Vermögenswerte mit relativen Pfaden verweist:

<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> 

Wie kann ich Gulp zwingen stattdessen absolute Pfade zu benutzen?

z. /scripts/ statt scripts/ und /styles/ statt styles/

Hier ist ein Auszug aus meinem aktuellen 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> 

Antwort

3

einfach die Dateipfade in den <!-- build: ... --> Kommentare angegeben ändern; Gulp benutzt sie explizit um ihre Ziele zu bauen!

<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>