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

postcss-watch-folder

v2.0.0

Published

PostCSS plugin which watches folder for new files

Downloads

1,001

Readme

GitHub release GitHub issues GitHub last commit Github file size npm npm Analytics

postcss-watch-folder

A PostCSS plugin to watch a folder for new files.

Why?

I've had issues when using globs to import stylesheets: @import 'settings/**/*.scss';.

The issues appear when using sass-loader and/or postcss-loader in webpack.

Basically, both SASS and PostCSS do not handle the event of adding files to a watched folder.

This simple plugin solves this issue by watching for add event and updating the main entrypoint.

Dependencies

  1. NodeJS
  2. NPM or Yarn
  3. PostCSS
  4. Bash Terminal (Default on OSX/Linux, GitBash on Windows)

Install

npm i postcss postcss-watch-folder --save-dev

or

yarn add postcss postcss-watch-folder --dev

Usage

Webpack:

module.exports = {
  ...
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          {
            loader: 'postcss-loader',
            options: {
              plugins: [
                require('postcss-watch-folder')({
                  folder: './your/stylesheets/folder',
                  main: './your/stylesheets/folder/main.css'
                }),
                ...other postcss plugins
              ],
            }
          }
        ]
      }
    ]
  }
}

The location of this plugin does not matter. It can be placed as first or last in the plugins array.

Options

There are two configuration options. They are both required and the plugin will not work if they are not provided:

folder: './assets/styles/',         // The folder to watch
main  : './assets/styles/main.css'  // The main styles entrypoint

Default options are:

folder: '.',           // Current working directory
main  : './style.css'  // style.css located in CWD

Demo

You can see a demo of the usage in my webpack boilerplate

Support this project

Tweet Donate Become a Patron

License

MIT