question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Piping assets to a destination without modification

See original GitHub issue

I’m just getting started with streams, and I’m hitting a bit of a wall. Basically, I want to get the assets picked up in my index.html build blocks, and write them to a dev folder, preserving their src attributes. But for some reason, this doesn’t output anything:

index.html

<!-- build:js(./bower_components/) libraries.js -->
<script src="lodash/lodash.js"></script>
<script src="firebase/firebase.js"></script>
<!-- endbuild -->

Gulpfile.js

gulp.task('pipeAssets', function () {
    return gulp.src('app/*.html')
        .pipe(useref.assets({ noconcat: true }))
        .pipe(debug())
        .pipe(gulp.dest('./output'));
});

I just want to do a straight copy of the files - and they’re in the stream if I use debug() - where am I going wrong? Thanks 😃

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
palmerjcommented, Apr 18, 2017

Having a little tap function like @amaeland also worked for me:

// Create output HTML pages from templates then
// concat & minify scripts and css
gulp.task('html', ['jshint', 'sass'], () => {
    return gulp.src('src/html/pages/**/*.hbs')
        .pipe(plumber())
        .pipe(handlebars({}, {
            ignorePartials: true,
            batch: ['src/html/partials']
        }))
        .pipe(rename({
            extname: '.html'
        }))
        .pipe(useref({ noconcat: development() }))
        .pipe(tap(function(file, t) {
            // ensure asset base path is aligned with
            // useref block asset paths within the html files
            if (['.js', '.css'].indexOf(file.extname) >= 0) {
                file.base = 'src';
            }
            return file;
        }))
        .pipe(gulpif('*.js', production(uglify())))
        .pipe(gulpif('*.css', production(cleanCss())))
        .pipe(gulp.dest('dist/'))
        .pipe(browserSync.stream());
});
0reactions
joshbernfeldcommented, Mar 5, 2020

Thank you @palmerj

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Asset Pipeline - Ruby on Rails Guides
The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write...
Read more >
Modifying a Pipeline - Hevo Data
Some Pipeline settings and Source and Destination settings can be modified even after Pipeline creation. For example, you can: Change the ...
Read more >
Customize pipeline configuration - GitLab Documentation
Specify a custom CI/CD configuration file · On the top bar, select Main menu > Projects and find your project. · On the...
Read more >
In-Bond Regulatory Changes Frequently Asked Questions
The in-bond process allows imported merchandise to be entered at one U.S. port of entry without appraisement or payment of duties and transported...
Read more >
ApiGateway::Method Integration - AWS CloudFormation
Integration is a property of the AWS::ApiGateway::Method resource that specifies information about the target backend that a method calls.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found