S
S
Sergey Goryachev2017-04-24 15:39:06
HTML
Sergey Goryachev, 2017-04-24 15:39:06

Why doesn't Jade compile?

There is a very simple

gulpfile.js
// include gulp
var gulp                = require('gulp');
var path                = require('path');
var browserSync         = require('browser-sync').create();

// include plugins
var sass                = require('gulp-sass');
var cssnano             = require('gulp-cssnano');
var sourcemaps          = require('gulp-sourcemaps');
var rename              = require('gulp-rename');
var jade                = require('gulp-jade');
var jadephp             = require('gulp-jade-php');
var autoprefixer        = require('gulp-autoprefixer');
var concat              = require('gulp-concat');
var uglify              = require('gulp-uglify');
var plumber             = require('gulp-plumber');

var assets_path         = 'assets/';
var content_path        = 'www/';
var template_path       = 'www/';
var localhost           = 'medgis.loc';

// compile sass and css files
gulp.task('sass', function(){
    return gulp.src([
        'assets/styles/all.scss'
    ])
    .pipe(sourcemaps.init())
    .pipe(plumber())
  .pipe(sass().on('error', sass.logError))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(path.join(content_path, 'css/')));
});
gulp.task('css', ['sass'], function(){
    return gulp.src(path.join(content_path, 'css/all.css'))
    .pipe(plumber())
  .pipe(sass().on('error', sass.logError))
    .pipe(autoprefixer({
        browsers: ['last 50 versions'],
        cascade: false
    }))
    .pipe(cssnano())
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest(path.join(content_path, 'css/')))
    .pipe(browserSync.reload({
         stream: true
    }));
});

// compile pug for php files
gulp.task('views', function(){
    return gulp.src([
        '!assets/views/**/_*.jade',
        'assets/views/index.jade'
    ])
    .pipe(plumber())
    .pipe(jade({
        pretty: '\t'
    }))
    .pipe(gulp.dest(path.join(template_path)))
    .pipe(browserSync.reload({
         stream: true
    }));
});

// concatenate and minify js
gulp.task('scripts', function(){
    return gulp.src([
        'assets/scripts/jquery.js',
        'assets/scripts/main.js'
    ])
    .pipe(plumber())
    .pipe(concat('all.min.js'))
    .pipe(uglify())
    .pipe(gulp.dest(path.join(content_path, 'js/')))
    .pipe(browserSync.reload({
         stream: true
    }));
});

// browser-sync task and settings
gulp.task('browserSync', ['css', 'scripts', 'views'], function(){
    browserSync.init({
        open: 'external',
        host: localhost,
        proxy: localhost,
        port: 8080
    });
});

// start watchers
gulp.task('watch', ['browserSync'], function(){
    gulp.watch('assets/styles/**/*.scss', ['css']);
    gulp.watch('assets/views/**/*.jade', ['views']);
    gulp.watch('assets/scripts/**/*.js', ['scripts']);
    gulp.watch('dist/**/*.html', browserSync.reload);
});

CSS compiles, JS does too.
And jade categorically refuses. Renaming to pug does not work.
There are no errors either.
For those who want to poke live, there is an archive .
I suspect that the problem is in me, but point-blank I do not see an error in the code.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
display: block, 2017-04-24
@webirus

Space.

S
Sergey Goryachev, 2017-04-24
@webirus

I don't know, but somewhere I got a gap.
Thanks to display: block for the tip.
The file was "index.jade".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question