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

Add support for css preprocessors #699

Closed
BadMask121 opened this issue Aug 16, 2020 · 5 comments
Closed

Add support for css preprocessors #699

BadMask121 opened this issue Aug 16, 2020 · 5 comments

Comments

@BadMask121
Copy link

Currently my scss files get compiled to css, I suggest there should be an option to turn off css bundling and support other css preprocessor

@wardpeet
Copy link
Collaborator

Hey, thank you for opening this issue. Why would you want to keep preprocess css? Microbundle is opinionated to compile everything away into css & javascript bundles. If you're looking for a different use case we suggest using rollup or any other bundler.

@BadMask121
Copy link
Author

@wardpeet thanks for the reply, by that doesn't work for my use case, ill explain

I have typescript a react component

import React from "react";
import { ReactComponent as Attachment } from "./assets/file-text.svg";
import "./style.scss";

interface IAttachment {
	text: string | React.ReactElement;
	style?: React.CSSProperties;
	fontSize?: string;
}
export default ({ text }: IAttachment) => {
	return (
		<p className="hello" >
			<Attachment /> &nbsp;
			{text}
		</p>
	);
};

and a style.scss file

.hello{
    color: blue;
}

building the component process the .scss file to index.scss contains the following:

._RB1TF {
  color: blue; }

the issue is when testing the component when inspected on the browser the className property remains as hello and not the processed classname, therefore not changing the color to blue as specified on the .scss file

@BadMask121
Copy link
Author

I believe the processed index.css file is not being required inside the build file index.moden.js and also the build is not changing the classname inside build file @adrienpoly

@developit
Copy link
Owner

Hi - this is CSS Modules, and is working as designed. You can turn it off by passing --css-modules false to Microbundle.

If you're still seeing this behavior with --css-modules false, it's likely #653. There's a bugfix for that going out shortly (though I can't speak to when that will arrive in microbundle-crl).

@developit
Copy link
Owner

I'm going to close this one out since it's either working-as-designed or a duplicate of #653.

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

3 participants