F
F
fantazerno2015-08-17 02:06:41
Node.js
fantazerno, 2015-08-17 02:06:41

How to properly set up gulp-useref for wordpress?

I have a standard wp folder structure

/- wp-content
         /themes/ 
                 /app/
                      /bower/ - все что скачено bower
                      header.php
gulpfile.js - лежит в корне

gulp handler
//useref
gulp.task('html', function () {
    var assets = useref.assets({searchPath: '/wp-content/themes/app/'});
    return gulp.src('wp-content/themes/app/*.php')
        .pipe(assets)
        .pipe(gulpif('*.js', uglify()))
        .pipe(gulpif('*.css', minifyCss()))
        .pipe(assets.restore())
        .pipe(useref())
        .pipe(gulp.dest('wp-content/themes/dist'));
});

If I use these paths, then everything is fine
<!-- build:css css/vendor.css -->
  
  <link rel="stylesheet" href="bower/normalize.css/normalize.css" />
  <link rel="stylesheet" href="bower/bootstrap/dist/css/bootstrap.min.css" />
  <link rel="stylesheet" href="bower/components-font-awesome/css/font-awesome.css" />
  <link rel="stylesheet" href="bower/owlcar/owl-carousel/owl.carousel.css" />

  <!-- endbuild -->

but if you substitute the full path /wp-content/themes/app/bower/normalize.css/normalize.css
then trouble
I will be glad of any help

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question