Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including postcss-omit-import-tilde with all npm packages installed. Try it out:

var postcssOmitImportTilde = require("postcss-omit-import-tilde")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

postcss-omit-import-tilde v1.0.1

PostCSS plugin to omit tilde in sass import function argument

PostCSS Omit Import Tilde

Build Status npm version

PostCSS plugin to omit tilde in sass import function argument.

Use Case

This plugin may be useful in case of large frontend ecosystem with different bundlers (webpack and gulp in my case).

For example, you have some sass file, which is built by webpack and depends from some external library. This library is imported by @import "~awesome-lib" (~ for root). Also you have another dependency from some internal file, which is built by gulp and has dependency @import "awesome-lib" (no tilde). This build is going to be broken, because webpack cannot import such dependency, and on the other hand, gulp cannot build @import "~awesome-lib" if we just change it.

So you can use this plugin in chain to build styles in gulp with dependency like @import "~awesome-lib";

Input

@import "~awesome-lib/awesome-style.scss";

Output

@import "awesome-lib/awesome-style.scss";

Usage

postcss([ require('postcss-omit-import-tilde') ])

See PostCSS docs for examples for your environment.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free