4.0.0 ā€¢ Published 4 months ago

@wayofdev/postcss-config v4.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Shareable PostCSS Config

šŸ“„ About

Shareable configuration for PostCSS ā€” a tool for transforming CSS with JavaScript.

The package provides a set of plugins and settings that can be easily shared and reused across different projects, reducing the amount of boilerplate code needed to set up PostCSS in each project.

ā†’ Purpose

Simplify the process of setting up PostCSS in a project by providing a pre-configured set of plugins and settings.

This package can be useful for developers who want to:

  • Use PostCSS in their project but don't want to spend time configuring it from scratch
  • Share PostCSS configuration across multiple projects
  • Avoid maintaining and updating PostCSS configuration in every project manually

  • Take advantage of preconfigured optimizations and plugins, such as:

    • autoprefixer ā€” adds vendor prefixes to CSS properties
    • cssnano ā€” minifies CSS files and removes unnecessary code
    • postcss-preset-env ā€” enables the use of future CSS features and converts them into compatible CSS code for current browsers.
    • postcss-import, which allows you to use @import statements in your CSS files, making it easy to split your code into multiple files and organize your CSS
    • postcss-100vh-fix ā€” fixes the issue where the height of an element with 100vh is taller than the viewport in some mobile browsers
    • postcss-flexbugs-fixes ā€” fixes various flexbox bugs in older versions of Safari and IE
    • [tailwindcss ā€” utility-first CSS framework for rapidly building custom user interfaces
    • [tailwindcss/nesting ā€” adds support for nested rules in Tailwind CSS
    • postcss-reporter ā€” logs PostCSS messages to the console with a clean and concise format

Developers can streamline the process of using PostCSS in their project and ensure a consistent configuration across different projects.

šŸ’æ Installation

To use this configuration, you'll need to install @wayofdev/postcss-config as a development dependency in your project. You can do this by running the following command:

pnpm add -D \
	postcss \
	@wayofdev/postcss-config \
	postcss-100vh-fix \
	postcss-flexbugs-fixes \
	postcss-import \
	postcss-preset-env \
	postcss-reporter

If you're working in a monorepository and want to add the package to a specific app, you can use the --filter flag to add it only to that app. For example:

pnpm --filter=[app-dir-name] add -D \
	postcss \
	@wayofdev/postcss-config \
	postcss-100vh-fix \
	postcss-flexbugs-fixes \
	postcss-import \
	postcss-preset-env \
	postcss-reporter

Replace [app-dir-name] with the name of the directory of the app where you want to install the package.

šŸ’» Usage

To use the @wayofdev/postcss-config package in your project, follow these steps:

  1. Create a file called postcss.config.js in the root folder of your project.
  2. Add the following code to the postcss.config.js file:
module.exports = require('@wayofdev/postcss-config')

If you're using a monorepository, your project structure might look like this:

.
ā””ā”€ā”€ apps
    ā”œā”€ā”€ docs    # example nextra app
    ā””ā”€ā”€ web     # example nextjs app
        ā”œā”€ā”€ postcss.config.js
        ā”œā”€ā”€ ... (other app files)
ā””ā”€ā”€ packages    # shared packages

ā†’ Extending the Configuration

To extend the @wayofdev/postcss-config configuration, create a new postcss.config.js file with the following code:

module.exports = {
  plugins: [
    ...require('@wayofdev/postcss-config').plugins,
    require('autoprefixer')
  ]
}

In this code, you're extending the plugins array of the existing configuration by first including the plugins in the original configuration using ...require('@wayofdev/postcss-config').plugins and then adding autoprefixer as a new plugin.

šŸ¤ License

Licence

šŸ§± Credits and Useful Resources

Based on:

šŸ™†šŸ¼ā€ā™‚ļø Author Information

This repository was created in 2023 by lotyp / wayofdev.

šŸ™Œ Want to Contribute?

Thank you for considering contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:

  • šŸ¤” Suggest a feature
  • šŸ› Report an issue
  • šŸ“– Improve documentation
  • šŸ‘Øā€šŸ’» Contribute to the code

You are more than welcome. Before contributing, kindly check our guidelines.

4.0.0

4 months ago

3.0.5

4 months ago

3.0.4

5 months ago

3.0.3

7 months ago

3.0.2

9 months ago

3.0.1

10 months ago

3.0.0

10 months ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.4

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.0

1 year ago