question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

something like `@import (reference)` from Less?

See original GitHub issue

hi.

is it possible to have this http://lesscss.org/features/#import-options-reference functionality?

for example I want to import vars.css file that contains only vars declarations to 100 other css files without inlining but using it as a reference to resolve vars.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aicommented, Apr 4, 2015

@deepsweet do you want to write your own plugin for this case? It is very easy.

I saw two API:

@import-part .selector "path/to/file.css";
@filter .selector {
    @import "path/to/file.css";
}

I prefer second API, because:

  1. postcss-import is a big plugin with many logic inside. Copy all of its code is not a good idea.
  2. @filter at-rule is more flexile way, which van be used in many cases.
  3. UNIX-way 😄
0reactions
MoOxcommented, Apr 4, 2015

postcss-simple-vars don’t produce any specific output, so you vars.css should not produce anything. You just need to use postcss-import before any other plugin + import your vars.css before other imports.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reference Imports in LESS (are kinda cool) - CSS-Tricks
Concatenating files is a vitally important feature of preprocessors. A (reference) import doesn't do that. In fact, it doesn't put anything at ...
Read more >
css - LESS import - reference vs once - Stack Overflow
The principle of once is to only import a file once. For example, you may have an import for mixins.less in both of...
Read more >
Features In-Depth | Less.js
Use @import (inline) to include external files, but not process them. Released v1.5.0. Example: @import (inline) "not-less-compatible.css";. You will use this ...
Read more >
When using an @import (reference), mixins that contain an ...
When I import a less file with the (reference) directive, I expect to see no CSS output from that file. However, I am...
Read more >
@import in CSS, SCSS, and LESS. @import rule ... - rohin bisht
import rule is present in CSS as well as popular preprocessor like ... they have anything yet comparable to the reference imports in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found