-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
I'm using gulp-sourcemaps to build a Post CSS based theme - and am seeing a "no sources" entry in the sources attribute of the generated map file.
using: "gulp-sourcemaps": "^3.0.0" & "gulp-postcss": "^10.0.0",
function styles() {
const autoprefixer = require('autoprefixer');
const postcss = require('gulp-postcss');
const nested = require('postcss-nested');
const calc = require('postcss-calc');
const atImport = require('postcss-import');
const perfectionist = require('perfectionist');
const postcssCustomMedia = require('postcss-custom-media');
const postcssCustomProperties = require('postcss-custom-properties');
const sourcemaps = require('gulp-sourcemaps');
const rename = require('gulp-rename');
return gulp.src('./css/neway_mods.pcss')
.pipe(sourcemaps.init())
.pipe(postcss([
atImport(),
nested(),
postcssCustomMedia(),
postcssCustomProperties({ preserve: false }),
calc(),
autoprefixer({ grid: 'no-autoplace' }),
perfectionist({ indentSize: 2 }),
]))
.pipe(sourcemaps.mapSources(function (sourcePath, file) {
// source paths are prefixed with '../src/'
return '' + sourcePath;
}))
.pipe(rename(function (path) {
// Updates the object in-place
if (path.extname == '.pcss') {
path.extname = '.css';
}
}))
.pipe(sourcemaps.write('.'))
.on('error', function (errorInfo) { // if the error event is triggered, do something
console.log(errorInfo.toString()); // show the error information
this.emit('end'); // tell the gulp that the task is ended gracefully and resume
})
//.pipe(replace(',"<no source>"', ''))
.pipe(gulp.dest('./css'));
}
This results in the map file:
{"version":3,"sources":["../../../../../core/themes/olivero/css/base/media-queries.pcss.css","neway_mods.pcss","<no source>"],"names":[],"mappings":"AA.....
I've been suppressing the error using a replacement clause at the end of the task - to remove the string - but thought it worthwhile noting here for any ideas?
Metadata
Metadata
Assignees
Labels
No labels