CSS Imports
All Axiom components import their own CSS files via import
statements from within the JS code.
Depending on your bundler you might require additional configuration to enable CSS imports.
Check out the guide on CSS Layers if your existing styles are conflicting with Axiom.
#
Next.js
#
#
App Router
#
If you are using the App Router then you do not need any additional configuration.
#
Pages Router
#
If you are using the Pages Router then you need to add our packages to the transpilePackages option:
next.config.js
export default {
// ...
transpilePackages: ["@optiaxiom/globals", "@optiaxiom/react"],
};
#
Webpack
#
#
Configure loaders
#
Follow the Webpack Asset Management guide to configure loading CSS and fonts.
Install the required style loaders.
npm install -D style-loader css-loader
Add the appropriate loaders in your Webpack config file.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
},
],
},
};
Last updated on