npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@igor-lemon/craco-antd-scss

v1.0.0

Published

Craco plugin for use SASS/SCSS in create-react-app projects

Downloads

4

Readme

Craco Ant Design SCSS plugin

[![actions-workflow-test][actions-workflow-test-badge]][actions-workflow-test] [![release][release-badge]][release] [![license][license-badge]][license]

About

@igor-lemon/craco-antd-scss is a Craco plugin which allows you to use SASS/SCSS in your create-react-app ^5.0.0 projects with Ant Design.

The plugin based on @igor-lemon/antd-scss-theme-plugin and craco-less plugins.

Installation

If you don't have craco you should to install it before. Then install @igor-lemon/craco-antd-scss:

$ yarn add @igor-lemon/craco-antd-scss --save-dev

# OR

$ npm i @igor-lemon/craco-antd-scss --save-dev

How to use

Create theme.scss. It's file where you can override antd variables. And modify your craco.config.js config file.

const CracoAntSCSSPlugin = require('@igor-lemon/craco-antd-scss');

module.exports = {
  plugins: [
    { 
      plugin: CracoAntSCSSPlugin, 
      options: { theme: './path_to/theme.scss' }
    }
  ],
};

For example put into theme.scss next variables

$primary-color: #92021F;
$link-color: #D3840D;

The list of variables you can find here: https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less

Configuration options

theme

  • Required. The path to the file with the variables you want to override.

lessOptions

Custom Less options. https://webpack.js.org/loaders/less-loader/#options Default:

{}

Set null if you don't want to apply @igor-lemon/antd-scss-theme-plugin to the Less loader.

sassOptions

Custom SASS/SCSS options. https://webpack.js.org/loaders/sass-loader/#options Default:

{}

Set null if you don't want to apply @igor-lemon/antd-scss-theme-plugin to the Less loader.

babelImportOptions

Babel Import plugin options. Default:

{
  libraryName: 'antd',
  libraryDirectory: 'lib',
  style: true
}

Additional Features

The plugin allows to use Ant Design variables in your SASS/SCSS files. If you want to use it feature just import theme.scss

Example:

@import "./path_to/theme";

.wrapper {
  background-color: $body-background;
  margin: $margin-md;
}

The disadvantage of this approach is that the IDE and linters doesn't see the values of these variables. It may not be so convenient to use them.

My advice is to just overwrite the used variables in theme.scss and set sassOptions option to null, this will reduce the rebuilding time.

const CracoAntSCSSPlugin = require('@igor-lemon/craco-antd-scss');

module.exports = {
  plugins: [
    { 
      plugin: CracoAntSCSSPlugin, 
      options: {
        sassLoaderOptions: null,
        theme: './path_to/theme.scss'
      }
    }
  ],
};

License

MIT