jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

useref is changing src path but not generating Javascript file #171

Closed evilgeniuscreative closed 8 years ago

evilgeniuscreative commented 8 years ago

I can't for the life of me make this output the Javascript file.

HTML:

<!-- build:js  scripts/combined.js -->
<script type="text/javascript" src = "src/vendor/jquery-1.12.0.min.js"></script>
<script type="text/javascript" src = "src/vendor/angular.1.4.8.min.js"></script>
<!-- endbuild -->

GULPFILE: var useref = require('gulp-useref');

gulp.task('useref',function(){
    return gulp.src('./*.html')
        .pipe(useref())
        .pipe(gulp.dest('dist'));
});

OUTPUT:

<script src="scripts/combined.js"></script>

But literally, zero Javascript files. So weird. Any thoughts, folks?

Doesn't seem to matter how I write the path to the gulp.src, whether ('.html') or ('./.html') or even ('index.html'), the tag gets converted fine, but there's not JS files.

jonkemp commented 8 years ago

Why do you have spaces around the equals sign in your script tag?

Are you calling the useref task directly? Can you try using gulp-debug?

evilgeniuscreative commented 8 years ago

1) Spaces with = ... no particular reason, just formatting. Will that whitespace make a difference? 2) Yes, having issues whether calling useref directly or as part of a watcher 3) I haven't tried gulp-debug, but I will. I'm new (as in 48 hours) to gulp

evilgeniuscreative commented 8 years ago

A: YES, THE WHITESPACE MAKES A DIFFERENCE :) Thanks.

That might be something to account for the possibility of at some point. Lord knows, we all use whitespace thoughtlessly sometimes.

Cheers! :100:

jonkemp commented 8 years ago

Can we close then?

evilgeniuscreative commented 8 years ago

Yes, thanks, however, I would suggest this be a change in the next release, since many IDE formatters add spaces for readability. :)