Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'replace' of undefined #240

Open
shooftie opened this issue Jul 7, 2017 · 1 comment
Open

TypeError: Cannot read property 'replace' of undefined #240

shooftie opened this issue Jul 7, 2017 · 1 comment

Comments

@shooftie
Copy link

shooftie commented Jul 7, 2017

I have tried everything and despite an irksome feeling that it is my incompetence I am at a loss.

I have the folder structure:

dist/
app/
    |- js/
        main.js
        plugins.js
    |- embeds/
        footer.php

footer.php looks like this:

        <footer class="body-footer">
            <p>&copy; My site 2017</p>
        </footer>
        <!--build:js js/main.js -->
        <script src="../js/plugins.js"></script>
        <script src="../js/main.js"></script>
        <!-- endbuild -->
    </body>
</html>

My gulp task looks like this:

gulp.task('useref', function () {
    return gulp.src('app/embeds/footer.php')
        .pipe(useref())
        .pipe(gulp.dest('dist'))
});

I keep getting this error:

TypeError: Cannot read property 'replace' of undefined
at module.exports (/my-project/repo/node_modules/useref/lib/getBlocks.js:31:19)
at module.exports (/my-project/repo/node_modules/useref/index.js:8:16)
at Gulp.<anonymous> (/my-project/repo/gulpfile.js:108:15)
at module.exports (/my-project/repo/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/my-project/repo/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/my-project/repo/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/my-project/repo/node_modules/orchestrator/index.js:134:8)
at /usr/local/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:46:20
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
@jonkemp
Copy link
Owner

jonkemp commented Mar 15, 2018

Haha, this is really late but it looks like useref is not getting the content from footer.php.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants