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

@import with url() gives empty importPath #75

Closed
jwilsson opened this issue May 18, 2017 · 1 comment
Closed

@import with url() gives empty importPath #75

jwilsson opened this issue May 18, 2017 · 1 comment

Comments

@jwilsson
Copy link
Collaborator

  • Node Version: 6.10.3
  • NPM Version: 4.6.1
  • postcss-less Version: 1.0.0

If you have a large amount of code to share which demonstrates the problem you're experiencing, please provide a link to your repository rather than pasting code. Otherwise, please paste relevant short snippets below.

LESS

@import url("foo.css")

JavaScript

const postcss = require('postcss');
const syntax = require('postcss-less');

const lessText = '@import url("foo.css")';

postcss([])
  .process(lessText, { syntax: syntax })
  .then(function (result) {
      console.log(result.root.first);
  });

Expected Behavior

Not sure, but importPath should at least contain something more than just ). I don't know what I think really, if the whole url("foo.css") should be put in importPath or something else like params (which is what PostCSS does for at-rules).

Actual Behavior

importPath doesn't contain anything but the closing parentheses:

Import {
  raws: { before: '', afterName: ' ' },
  type: 'import',
  nodes: [],
  name: 'import',
  parent:
   Root {
     raws: { semicolon: false, after: '' },
     type: 'root',
     nodes: [ [Circular] ],
     source: { input: [Object], start: [Object] },
     lastEach: 1,
     indexes: {} },
  source:
   { start: { line: 1, column: 1 },
     input: Input { css: '@import url("foo.css")', id: '<input css 1>' },
     end: { line: 0, column: 0 } },
  importPath: ')',
  directives: '',
  lastEach: 1,
  indexes: {} }

How can we reproduce the behavior?

Please see code in JavaScript section.

@jwilsson jwilsson changed the title @import with url() isn't parsed correctly @import with url() gives empty importPath May 18, 2017
@shellscape
Copy link
Owner

Hm yeah, that's a problem alright. Oversight on my part. Would loooooove a PR for this, because I won't be able to circle back to it until probably next week.

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

2 participants