gulp z gulp-ruby - sass: Error:./ stylecss.mapa: 3: 1: nieznane słowo

Uzyskanie dziwnego błędu przy użyciu podstawowego zegarka gulp / express build.

Układ Katalogów

 project/
   - sass/
      - style.scss
   - gulpfile.js
   - index.html

/ align = "left" / js

var gulp         = require('gulp'),
    sass         = require('gulp-ruby-sass'),
    autoprefixer = require('gulp-autoprefixer'),
    minifycss    = require('gulp-minify-css'),
    rename       = require('gulp-rename');

gulp.task('express', function() {
  var express = require('express');
  var app = express();
  app.use(require('connect-livereload')({port: 4002}));
  app.use(express.static(__dirname));
  app.listen(4000);
});

var tinylr;
gulp.task('livereload', function() {
  tinylr = require('tiny-lr')();
  tinylr.listen(4002);
});

function notifyLiveReload(event) {
  var fileName = require('path').relative(__dirname, event.path);

  tinylr.changed({
    body: {
      files: [fileName]
    }
  });
}

gulp.task('styles', function() {
    return gulp.src('sass/*.scss')
      .pipe(sass({ style: 'expanded', sourcemap: false }))
      .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
      .pipe(gulp.dest('css'))
      .pipe(rename({suffix: '.min'}))
      .pipe(minifycss())
      .pipe(gulp.dest('css'));
});

gulp.task('watch', function() {
  gulp.watch('sass/*.scss', ['styles']);
  gulp.watch('*.html', notifyLiveReload);
  gulp.watch('css/*.css', notifyLiveReload);
});

gulp.task('default', ['styles', 'express', 'livereload', 'watch'], function() {

});

Styl.scss

body { position: relative; }

Express server / livereload działa dobrze, ale gdy próbuje skompilować arkusz stylów dostaję ten błąd (nawet z sourcemap: false)

gulp-ruby-sass: write style.css.map

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: <LOCAL_PATH_HERE>/style.css.map:3:1: Unknown word
Author: elzi, 2014-11-17

5 answers

Wyłączenie sourcemaps jest teraz jakąś tajemnicą. Musisz to zrobić tak

.pipe(sass({ "sourcemap=none": true }))

Źródło

 17
Author: ProblemsOfSumit,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-11-20 11:43:23

Nie do końca pewne Dlaczego to to naprawia, ale zmiana rury autoprefixera na:

.pipe(autoprefixer({
     browsers: ['last 2 versions'],
     cascade: false
}))

I umieszczenie go przed rurą sass (górną) pozwala na jej pomyślną budowę.

 5
Author: elzi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-11-17 18:52:25

Naprawiłem ten problem zachowując mapy źródłowe i używając gulp-filter :

var filter = require('gulp-filter')
var filterCSS = filter('**/*.css');

gulp.task('styles', function() {
    return gulp.src('sass/*.scss')
      .pipe(sass({ style: 'expanded', sourcemap: true }))

      // Filters only css files before auto prefixing
      .pipe(filterCSS)
      .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
      .pipe(filterCSS.restore())

      .pipe(gulp.dest('css'))
      .pipe(rename({suffix: '.min'}))
      .pipe(minifycss())
      .pipe(gulp.dest('css'));
});
 4
Author: gpbl,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-11-22 01:18:49

Miałem ten sam problem z gulp-ruby-Sass plugin . Znalazłem to wpis na blogu, który wyjaśnia, że w wtyczce gulp-ruby-Sass jest kilka błędów dotyczących map źródłowych. Oba zostały zamknięte nieco ponad tydzień temu. Jeśli uaktualnisz do gulp-ruby-Sass~1.0.0-alpha powinno to rozwiązać problemy z mapami źródłowymi.

Jeśli to nie działa artykuł, który podlinkowałem powyżej pokazuje jak korzystać z wtyczki gulp-sass który nie ma problemu z mapą źródłową.

 2
Author: Trenell Galman,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-11-29 14:39:28

Spróbuj uaktualnić do gulp-ruby - Sass 1.0.0-alpha. Używa gulp-sourcemaps i powinien unikać wszystkich iteracji tego problemu.

 0
Author: RobW,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-11-27 16:32:25