@webpackon/use-css
v1.1.3
Published
Webpackon use css
Downloads
5
Maintainers
Readme
@webpackon/use-css
Features:
- adds css support
- minification css
- optimizing css with cssnano
- adds autoprefixer and postcss flexbugsFixes
Install
npm i @webpackon/use-css --save
yarn add @webpackon/use-css
API
const { useCss } = require('@webpackon/use-css');
useCss(params: UseCssParams)(config: WebpackConfig)
UseCssParams
export type UseCssParams = {
mode: 'development' | 'production';
transpileModules?: string[];
enableCssModules?: boolean;
cssLoaderParams?: {
options?: Record<string, any>;
};
postCssPlugins?: any[];
postCssLoaderOptions?: {
options?: Record<string, any>;
};
};
mode - webpack mode
enableCssModules - adds css modules support
cssLoaderParams.options - css-loader options
postCssPlugins - postcss plugins option
postCssLoaderOptions.options - postcss-loader option
transpileModules
useCss({
mode: 'production',
transpileModules: ['my-package']
})
Example
Full examples are here
const path = require('path');
const { compose } = require('@webpackon/core');
const { useCss } = require('@webpackon/use-css');
module.exports = (_, { mode }) =>
compose(
useCss({ mode })
)({
target: 'web',
entry: path.resolve(__dirname, 'src', 'index.tsx'),
});