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

node-sass-glob-importer-deep

v1.0.0

Published

Custom node-sass package importer that allow you to use deep glob syntax in node-sass imports.

Downloads

6

Readme

node-sass-glob-importer-deep

Custom node-sass package importer that allow you to use deep glob syntax in node-sass imports.

⚠ Please note, this importer is based on the node-sass-glob-importer npm package. Both packages will check automatically for nested directions, the different is that this deep package will shift all nested @import above in the sass imports hierarchy, during that the node-sass-glob-importer will stay at the same hierarchy pattern.

tree

.
├── gulpfile.js
└── src
    ├── components
    │   ├── form
    │   │   ├── error
    │   │   │   └── _control.scss
    │   │   ├── _control.scss
    │   │   └── _group.scss
    │   ├── _card.scss
    │   └── _menu.scss
    ├── _config.scss
    ├── _functions.scss
    ├── _mixins.scss
    └── index.scss

./src/index.scss

// Import all files inside the `components` directory and subdirectories and their subdirectories children and so on...
@import "config";
@import "functions";
@import "mixins";
@import "components/**/*";

E.G index.scss stream output before sass compilation

@import "_config.scss";
@import "_functions.scss";
@import "_mixins.scss";
@import "components/form/error/_control.scss"; // ← Has been shifted above in the SASS imports stack hierarchy 
@import "components/form/_control.scss";
@import "components/form/_group.scss";
@import "components/_card.scss";
@import "components/_menu.scss";

Usage

gulp

const { src, dest, series } = require('gulp');
const sass = require('gulp-sass')( require('node-sass') );
const globImporterDeep = require('node-sass-glob-importer-deep');

const styles = () => {
    return src('./src/index.scss')
        .pipe(sass({
            importer: globImporterDeep()
        })
        .on('error', sass.logError))
        .pipe(dest('./dist/css'))
};

exports.default = series(styles);

webpack

// webpack.config.js
const globImporterDeep = require('node-sass-glob-importer-deep');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          {
            loader: MiniCssExtractPlugin.loader,
          },
          {
            loader: 'css-loader'
          }, {
            loader: 'sass-loader',
            options: {
              implementation: require('node-sass'),
              sassOptions: {
                importer: globImporterDeep()
              }
            }
          }
        ]
      }
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: 'style.css'
    })
  ]
}

See Also

Credits

License

MIT