Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

importFrom not working #152

Closed
frippz opened this issue Oct 24, 2018 · 11 comments
Closed

importFrom not working #152

frippz opened this issue Oct 24, 2018 · 11 comments

Comments

@frippz
Copy link

frippz commented Oct 24, 2018

With reference to this closed issue: #141

I've got a similar setup, wherein I transpile separate files, so I gathered that importFrom was needed for postcss-custom-properties to work properly. My postcss.config.js:

module.exports = {
  map: { inline: true },
  plugins: [
    require('postcss-custom-properties')({
      importFrom: 'src/css/00_variables.css'
    }),
  ]
};

Checking the output, however, shows this:

#header {
  background-color: var(--header-background);
  background-color: var(--header-background);
  color: var(--header-text);
  color: var(--header-text);
  padding: 0;
}

This repo is publicly available over here should anyone want to have a closer look. Just to make sure that my config file was actually working, I quickly tested to add preserve: false which confirmed that it is (since those duplicated lines went away). Something might be off with the path, perhaps? I've tried both importFrom: 'src/css/00_variables.css' as well as importFrom: './src/css/00_variables.css'. The src folder does reside in the project root.

@frippz frippz changed the title importFrom not working importFrom not working Oct 24, 2018
@frippz frippz changed the title importFrom not working importFrom not working Oct 24, 2018
@silvenon
Copy link

Since these issues you've made some changes to the repository, could you point to the exact commit in your code where you experienced this behavior?

@frippz
Copy link
Author

frippz commented Oct 30, 2018

@silvenon I'm so sorry, of course! I just kept on working and forgot about this. 😳 Right now I'm running without fallbacks for custom properties, but of course better legacy support is preferable.

Here's a snapshot from when I last had this issue: https://github.com/frippz/frippz.se/tree/6db2fd86364283a41b872a3e610cf9e304cfe7fe

@ghost
Copy link

ghost commented Nov 2, 2018

@silvenon i am also having this issue, i am trying to use importFrom to import some css variables and exportTo to output the file, the output file is created, but always empty.

@silvenon
Copy link

silvenon commented Nov 2, 2018

@mike-rotate are you using exportTo from postcss-preset-env or are you using postcss-custom-properties directly?

@ghost
Copy link

ghost commented Nov 3, 2018

@silvenon i'm using it in an object passed in to postcss-preset-env

@silvenon
Copy link

silvenon commented Nov 3, 2018

It's a different issue then, you can subscribe to csstools/postcss-preset-env#93 to track progress.

@ghost
Copy link

ghost commented Nov 3, 2018

@silvenon argh, sorry! i didn't realise i had switch to this github repo while following a trail of issues.

@silvenon
Copy link

silvenon commented Nov 3, 2018

No problem, they're all connected 😉

@jonathantneal
Copy link
Member

Closing this one to help me stay focused. I might have some time to work on it tonight.

@morganfeeney
Copy link

morganfeeney commented Jul 14, 2019

Hey all, can I ask what was the outcome of this issue? I believe I am facing the same thing here: csstools/postcss-preset-env#141

@jonathantneal
Copy link
Member

From the other issue.

After doing some further searching it looks as though what I expect to happen, will not. It looks like I need to use exportTo to get the imported custom properties into :root.

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

No branches or pull requests

4 participants