sciactive / pnotify

Beautiful JavaScript notifications with Web Notifications support.
https://sciactive.com/pnotify/
Apache License 2.0
3.65k stars 513 forks source link

Injecting Pnotify to Html using gulp-inject and main-bower-files libs causes wrong order #248

Closed tnusraddinov closed 8 years ago

tnusraddinov commented 8 years ago

Hi thanks for great library. I want to ask about injection of pnotify to html using gulp-inject and main-bower-files libs. This is how I inject:

gulp.task('inject', function () {
         return gulp.src('./SPA/App/index.html')
                      .pipe(inject(gulp.src(mainBowerFiles(), { read: false }), { name: 'bower' }))              
                      .pipe(gulp.dest('./SPA/App'));
});

and this is the order in the index.html:

<script src="/SPA/bower_components/pnotify/dist/pnotify.animate.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.buttons.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.callbacks.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.confirm.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.desktop.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.history.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.mobile.js"></script>
    <script src="/SPA/bower_components/pnotify/dist/pnotify.nonblock.js"></script>

how to inject them in right order (pnotify.js should be on the top)

corentin-gautier commented 8 years ago

Made a PR about this #235

tnusraddinov commented 8 years ago

Solved it by overriding main in gulpfile.js for pnotify like

{
    "overrides": {
          "pnotify": {
                "main": ["**/pnotify.js", "**/pnotify.confirm.js", "**/*.css"]
           }          
     }
}

now it is in order

<script src="/SPA/bower_components/pnotify/dist/pnotify.js"></script>
<script src="/SPA/bower_components/pnotify/dist/pnotify.confirm.js"></script>