1. postcss-atroot
PostCSS plugin to place rules directly at the root
postcss-atroot
Package: postcss-atroot
Created by: OEvgeny
Last modified: Fri, 06 Oct 2023 16:30:56 GMT
Version: 0.2.4
License: MIT
Downloads: 309,594
Repository: https://github.com/OEvgeny/postcss-atroot

Install

npm install postcss-atroot
yarn add postcss-atroot

PostCSS at-root Circle CI

PostCSS plugin to place rules directly at the root node.

The @at-root causes one or more rules to be emitted at the root of the document, rather than being nested beneath their parent selectors:

 .parent {
  ...
  @at-root{
    .child {...}
  }
}

Which would produce:

 .child { ... }
.parent { ... }

It will play well with postcss @include plugins.
foo.css:

 @at-root {
  @viewport { width: device-width; }
}
.foo {
  color: blue;
}

bar.css:

 .bar {
  @import "foo.css";
}

Will produce:

 @viewport { width: device-width; }

.bar .foo {
  color: blue; 
}

Usage

 postcss([ require('postcss-atroot')() ])

See PostCSS docs for examples for your environment.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin