Skip to content
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

<no source> seen in generated site map #394

Open
neway opened this issue Sep 10, 2024 · 0 comments
Open

<no source> seen in generated site map #394

neway opened this issue Sep 10, 2024 · 0 comments

Comments

@neway
Copy link

neway commented Sep 10, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant