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 url() without quotes omits importPath #77

Closed
jwilsson opened this issue May 29, 2017 · 2 comments
Closed

@import url() without quotes omits importPath #77

jwilsson opened this issue May 29, 2017 · 2 comments

Comments

@jwilsson
Copy link
Collaborator

Seems we missed this one in #75 :/

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

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.less)

JavaScript

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

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

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

Expected Behavior

There should be a importPath property on the Import node containing foo.less.

Actual Behavior

It's putting (foo.less) in directives and omits importPath completely:

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

How can we reproduce the behavior?

Please see code in JavaScript section.

@shellscape
Copy link
Owner

https://github.com/shellscape/postcss-less/blob/master/lib/less-parser.js#L150 here's the method that handles it. Please do see if you can get a PR together for it.

@jwilsson
Copy link
Collaborator Author

@shellscape I'll see what I can do!

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