-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty file & gulp-sourcemaps never completes #122
Comments
Please add the following:
|
"gulp": "^3.8.10",
"gulp-less": "^2.0.1",
"gulp-load-plugins": "^0.8.0",
"gulp-sourcemaps": "^1.3.0" var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
gulp.task('less', function () {
gulp.src('public/**/*.less', { base: '.' })
.pipe(plugins.sourcemaps.init())
.pipe(plugins.less())
.pipe(plugins.sourcemaps.write())
.pipe(gulp.dest('.'));
}); Also tried without var gulp = require('gulp');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('less', function () {
gulp.src('public/**/*.less', { base: '.' })
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write())
.pipe(gulp.dest('.'));
}); |
Can you add a example |
The issue presents itself when compiling an empty less file. |
I created a simple gist that I hope helps demonstrate the issue. I added an error listener and include the output from that in the gist. |
I am having the same issue. |
For now I resoved the issue on empty files with gulp-clip-empty-files.
But this doesn't work if the content of the file is an empty css rule:
|
@HaNdTriX Does the autoprefix plugin support sourcemaps? Try using gulp-autoprefixer instead. I had the same issue with gulp-stylus where some of the plugins were mangling sourcemaps |
I am using less-plugin-autoprefix and it works fine. The issue also exist without less plugins. |
@HaNdTriX I have received issues that say sourcemaps in less-plugin-autoprefix are broken/non-existant. Could you double check? |
The original issue I filed was without less-plugin-autoprefix, and the addition of less-plugin-autoprefix or gulp-autoprefix does not appear to have any impact. |
Can you try this in 2.0.3? I think it was an error reporting issue |
This got fixed in less/less.js#2439 |
Looks like it's broken different way now: ∴ gulp-less-test gulp less
[09:32:06] Using gulpfile ~/Desktop/gulp-less-test/gulpfile.js
[09:32:06] Starting 'less'...
[09:32:06] Finished 'less' after 8.65 ms
undefined:1
undefined
^
SyntaxError: Unexpected token u
at Object.parse (native)
at /Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/accord/lib/adapters/less.js:48:32
at /Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/render.js:35:17
at /Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/parse.js:63:17
at Object.finish [as _finish] (/Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/parser/parser.js:183:28)
at Object.ImportVisitor._onSequencerEmpty (/Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/visitors/import-visitor.js:35:14)
at ImportSequencer.tryRun (/Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/visitors/import-sequencer.js:50:14)
at Object.ImportVisitor.run (/Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/visitors/import-visitor.js:29:25)
at Object.Parser.parse (/Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/parser/parser.js:189:22)
at Object.parse (/Users/heikki/Desktop/gulp-less-test/node_modules/gulp-less/node_modules/less/lib/less/parse.js:61:18) {
"dependencies": {
"gulp": "^3.8.11",
"gulp-less": "^3.0.0",
"gulp-sourcemaps": "^1.3.0"
}
} var gulp = require('gulp');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('less', function () {
gulp.src('public/**/*.less', { base: '.' })
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write())
.pipe(gulp.dest('.'));
}); |
@Jenius looks like an accord bug to me |
@Jenius https://github.com/jenius/accord/blob/master/lib/adapters/less.coffee#L24 is the culprit. Probably passing undefined to JSON.parse @heikki if you add a guard for undefined around that JSON.parse call does it fix the problem? |
@contra |
@heikki Maybe send a PR? Would get it fixed a lot quicker |
Thanks for the PR, fixed and shipped as |
Update accord to ^0.15.1 to finalize #122
If I try to compile an empty less file and use gulp-sourcemaps, the task starts but never completes.
The text was updated successfully, but these errors were encountered: