A
A
artjerom2015-10-09 04:12:31
css
artjerom, 2015-10-09 04:12:31

Why doesn't stylus gulp-connect work?

Everything works fine, except for gulp-stylus. Although gulp compiles the file to css, but livereload does not work on it, as well as on a compiled css file

gulp = require 'gulp'
connect = require 'gulp-connect'
jade = require 'gulp-jade'
stylus = require 'gulp-stylus'
coffee = require 'gulp-coffee'
uglify = require 'gulp-uglify'
clean = require 'gulp-clean'
rjs = require 'gulp-requirejs'

gulp.task 'connect', ->
  connect.server
    port: 1337
    livereload: on
    root: './dist'

gulp.task 'jade', ->
  gulp.src 'jade/*.jade'
  .pipe do jade
  .pipe gulp.dest 'dist'
  .pipe do connect.reload
# Проблемный участок
gulp.task 'stylus', ->
  gulp.src 'stylus/*.styl'
  .pipe stylus set: ['compress']
  .pipe gulp.dest 'dist/css'
  .pipe do connect.reload
# Проблемный участок
gulp.task 'build', ['coffee'], ->
  rjs
    baseUrl: 'js'
    name: '../bower_components/almond/almond'
    include: ['main']
    insertRequire: ['main']
    out: 'all.js'
    wrap:on
  .pipe do uglify
  .pipe gulp.dest 'dist/js'
  .pipe do connect.reload

  gulp.src 'js/', read: no
    .pipe do clean

gulp.task 'coffee', ->
  gulp.src 'coffee/*.coffee'
  .pipe do coffee
  .pipe gulp.dest 'js'

gulp.task 'watch', -> 
  gulp.watch 'jade/*.jade', ['jade']
  gulp.watch 'stylus/*.stylus', ['stylus']
  gulp.watch 'coffee/*.coffee', ['build']

gulp.task 'default', ['stylus', 'jade', 'build', 'connect', 'watch',]

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