2016-02-15 3 views
0

с использованием postcss-scss и он должен разрешать // внутри scss-файлов.gulp + postCSS + typescript ... throws on // синтаксис

вместо этого, получение ...

` Неизвестное слово

// инжектор

вот моя задача глотком.

var postcss  = require('gulp-postcss'); 
var reporter = require('postcss-reporter'); 
var syntax_scss = require('postcss-scss'); 
var stylelint = require('stylelint'); 

gulp.task("scss-lint", function() { var stylelintConfig = { 
"plugins": [ 
    "stylelint-statement-max-nesting-depth" 
], 
"rules": { 
    "statement-max-nesting-depth": [3, { countAtRules: false }], 
    "block-no-empty": true, 
    "color-no-invalid-hex": true, 
    "declaration-colon-space-after": "always", 
    "declaration-colon-space-before": "never", 
    "function-comma-space-after": "always", 
    "function-url-quotes": "double", 
    "media-feature-colon-space-after": "always", 
    "media-feature-colon-space-before": "never", 
    "media-feature-name-no-vendor-prefix": true, 
    "max-empty-lines": 5, 
    "number-leading-zero": "never", 
    "number-no-trailing-zeros": true, 
    "property-no-vendor-prefix": true, 
    "rule-no-duplicate-properties": true, 
    "declaration-block-no-single-line": true, 
    "rule-trailing-semicolon": "always", 
    "selector-list-comma-space-before": "never", 
    "selector-list-comma-newline-after": "always", 
    "selector-no-id": true, 
    "string-quotes": "double", 
    "value-no-vendor-prefix": true}} 

var processors = [stylelint(stylelintConfig),reporter({clearMessages: true,throwError: true})]; 

return gulp.src(['src/**/*.scss']).pipe(postcss(processors), {syntax: syntax_scss});}); 

В нем говорится, что postcss-scss допускает // синтаксис комментария.

вот полный файл ... СКС

.slide-toggle { overflow: hidden; transition: all 1.5s;} 

.angular-google-map-wrapper { 
position:relative; 
height: 100%; 
width: 100%; 
} 

.angular-google-map-container { 
position: absolute; 
top: 0; 
bottom: 0; 
right: 0; 
left: 0; 
} 

/** 
* Do not remove the comment below. It's the markers used by gulp-inject to inject 
*/ 
// injector 
// endinjector 

, так как файл автоматически генерируется, я не буду в состоянии удалить //.

+0

Не могли бы вы разместить часть SCSS, включая строку, которая не работает? – Calvin

+0

эй @calvin. это двойная косая черта '/ ** @import url (http://fonts.googleapis.com/css?family=Roboto+Slab:400,700|Roboto:400,700,700italic,400italic); @ font-face { font-family: 'Material Icons'; font-style: normal; font-weight: 400; src: url (../../ bower_components/material-design-iconfont/iconfont/MaterialIcons-Regular.eot);/* Для IE6-8 */ /** * Не удаляйте, пожалуйста, комментарий ниже. */ // инжектор // endinjector ' – 0101adm

ответ

1

вопрос вы здесь на последней строке:

return gulp.src(['src/**/*.scss']).pipe(postcss(processors), {syntax: syntax_scss});}); 

Ваш скобка не обернута правильно и, таким образом, ваши варианты не передаются правильно postcss.

Оно должно быть:

return gulp.src(['src/**/*.scss']).pipe(postcss(processors, {syntax: syntax_scss}));}); 

Я отформатированный ответ, чтобы сделать его более удобным для чтения.

return gulp 
    .src(['./*.scss']) 
    .pipe(postcss(processors, { 
    syntax: syntax_scss 
    })); 
}); 
+0

работал. Благодарю. – 0101adm

+0

@ user3033234 Примите ответ правильно, если он работает для вас. Очень признателен! – Calvin

Смежные вопросы