M
M
Muhammad2015-11-10 13:10:09
Web development
Muhammad, 2015-11-10 13:10:09

Gulp WireDep - why styles and scripts are not collected in one file?

Hello. I recently started learning Gulp with tutorials from Loftblog. Stuck on the fifth lesson, because. Unable to merge required files into one. My default task:

var gulp = require('gulp');
var jade = require('gulp-jade');
var wiredep = require('wiredep').stream;
...
var config = require('./config');
var path = require('./paths');
...

gulp.task('build', ['clean', 'html', 'styles', 'scripts']);

gulp.task('watch', function() {
  gulp.watch(path.src.jade, ['html']);
  gulp.watch(path.src.stylus, ['styles']);
  gulp.watch(path.src.stylus, ['scripts']);
});

gulp.task('default', ['connect', 'build', 'watch']);

Jade compilation task:
gulp.task('html', function () {
  return gulp.src(path.src.jade)
    .pipe(jade(config.jade))
    .pipe(wiredep(config.wiredep))
    .pipe(gulp.dest(path.build.html))
    .pipe(connect.reload());
});

The file itself src/index.jade:
doctype html
- var cssFolder = "assets/css/"
html
    head
        title Document
        meta(charset="utf-8")

        // build:css(.) assets/css/vendor.css
        // bower:css
        // endbower
        // endbuild
    body
        header
            h1 Test
        p.
            Lorem Ipsum - это текст-"рыба"
        footer

    // build:js(.) assets/js/vendor.js
    // bower:js
    // endbower
    // endbuild

All libraries installed by bower are included, but for some reason they are not collected in vendor.css/vendor.js. Everything seems to be like in the video. What am I doing wrong?
UPD: Tried two options: build:js(.) assets/js/vendor.jsandbuild:js assets/js/vendor.js

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Zachinalov, 2015-11-10
@muhammad_97

wiredep takes the bower files that are listed in the dependencies. First you need to make sure that these dependencies are in bower.json, i.e. have you installed all bower plugins with the --save option. If there is no bower.json file itself, then run the bower init command and it will appear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question