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 PostCSS .css files #7

Closed
nathanchase opened this issue Aug 8, 2018 · 6 comments
Closed

Import PostCSS .css files #7

nathanchase opened this issue Aug 8, 2018 · 6 comments

Comments

@nathanchase
Copy link

I have mixins, custom-media, and other PostCSS-only features that I'd like to store in a .css file and import them into my components using style-resources-loader, but it appears this only works with LESS, SCSS, SASS, and Stylus.

Would it be possible to point it directly to a .css file that contained some PostCSS extended features?

Something like:

patterns: [
     path.resolve(__dirname, 'path/to/postcss/mixins/*.css'),
     path.resolve(__dirname, 'path/to/postcss/custommedia/*.css')
],

?

@yenshih
Copy link
Owner

yenshih commented Aug 8, 2018

Nice suggestion!
Yes, it currently only supports sass scss less styl files. But It's not hard to support css.
I will get it done in a few days (2 or 3 maybe), including documentation & test cases, and publish v1.2.0 in this weekend.
Thanks :)

@nathanchase
Copy link
Author

Fantastic! I appreciate it, and look forward to it!

@yenshih
Copy link
Owner

yenshih commented Aug 11, 2018

I've bumped it to v1.2.0, hope it helps! @nathanchase

@yenshih yenshih closed this as completed Aug 14, 2018
@nathanchase
Copy link
Author

nathanchase commented Aug 14, 2018

I couldn't get it to work with custom media queries. Is that beyond the scope of this loader?

i.e. custommedia.css

@custom-media --larger-than-skyscraper (min-width:160px);
@custom-media --larger-than-iphone-se (min-width:374px);
@custom-media --larger-than-mobile (min-width: 414px);
@custom-media --larger-than-phablet (min-width: 550px);
@custom-media --larger-than-leaderboard (min-width:728px);
@custom-media --larger-than-tablet (min-width: 750px);
@custom-media --larger-than-desktop (min-width: 1000px);
@custom-media --larger-than-ipad (min-width: 1024px);
@custom-media --larger-than-desktop-hd (min-width: 1200px);
@custom-media --full-size (min-width: 1440px);

and

options: {
  patterns: [
    path.resolve(__dirname, 'path/to/css/custommedia.css'),
  ]
}

Does it only support variables and mixins specifically?

@yenshih
Copy link
Owner

yenshih commented Aug 15, 2018

Does it only support variables and mixins specifically?

Absolutely not. It just simply insert those resources into your source file.
Maybe you could check if your patterns is correct.
custommedia.css.css -> custommedia.css?

@nathanchase

@nathanchase
Copy link
Author

Ok, I'll take another look and see if I can get it working.

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

No branches or pull requests

2 participants