@novicell/postcss-config

A postCSS 8 config for Nuxt and vite
6,858
Install
npm install @novicell/postcss-config
Latest Version:0.4.2
License:MIT
Last Updated:Aug 23, 2022
Links: npm
Maintainer: emilras

Novicell PostCSS config

npm

This is an PostCSS 8 config for vite or Nuxt projects written with PostCSS.

Included plugins

How to install in a Nuxt 3 project

  1. npm i @novicell/postcss-config
    
  2. Add the following to nuxt.config.ts
    • Import the default config in top of nuxt.config.ts
    import postcssConfig from '@novicell/postcss-config';
    
    • Add the config inside defineNuxtConfig section
    postcss: {
      postcssOptions: {
        plugins: {
          ...postcssConfig({
            // Your overriding options
          })
        }
      }
    }
    

How to install in a vite project

  1. npm i postcss @novicell/postcss-config
    
  2. Add the following to vite.config.ts
    • Import the array config in top of vite.config.ts since vite doesn't support Object type plugin config.
    import { postcssArrayConfig } from '@novicell/postcss-config';
    
    • Add the config inside defineConfig section
    css: {
      postcss: {
        plugins:[
          ...postcssArrayConfig({
            // Your overriding options
          }) 
        ]
      }
    }
    

Default plugins and options

These are the default plugins and options provided by @novicell/postcss-config

{
  'postcss-import': {},
  'postcss-inline-media': {},
  'postcss-nested': {},
  'postcss-calc': {},
  'postcss-preset-env': {
    stage: 2,
    preserve: process.env.NODE_ENV !== 'production',
    importFrom: ['assets/css/_mediaqueries.css', 'assets/css/_variables.css'],
    features: {
      'color-mod-function': { unresolved: 'warn' },
      'custom-media-queries': {}
    },
    browsers: ['>= 5% in DK']
  },
  'postcss-reporter': {
    clearReportedMessages: true
  }
}

Overriding options

It's possible to modify all the options of the plugins used in postcssConfig. Simply add the override as a keyed object with the postCSS plugin name like this...

...postcssArrayConfig({
  'postcss-preset-env': {
    preserve: false,
    importFrom: ['assets/_mediaqueries.css', 'assets/_variables.css'],
  },
  'postcss-reporter': {
    clearReportedMessages: false
  }
}) 

Contribution

Looking to contribute something? Here's how you can help. Please take a moment to review our contribution guidelines in order to make the contribution process easy and effective for everyone involved.

License

The Novicell CSS Utils is licensed under the MIT license. (http://opensource.org/licenses/MIT)

Related Packages

postcss-grouped-plugins

group multiple postcss plugins into a single plugin for nuxt

2,509 0
@vue/create-eslint-config

Utility to setup ESLint in Vue.js projects.

27,225 52
eslint-config-ktsn-vue

ESLint config for Vue.js project

12,758 1
@detools/eslint-config-vue

Eslint Shared Config for Vue based on AirBnB Styleguide

8,977 1
ada

a simple frentend build tool

6,310 5

Version History

Version Released License
0.4.2 MIT
0.4.1 MIT
0.4.0 MIT
0.3.1 MIT
0.3.0 MIT