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

nuxt-bulma-slim

v0.4.0

Published

Nuxt.js module to automatically make a slim Bulma build of used features with Purgecss

Downloads

55

Readme

nuxt-bulma-slim

Nuxt.js module to automatically make a slim Bulma build of used features with Purgecss. Simply drop in this module and save precious kilobytes. Also gets rid of annoying warnings for you.

Demo

Setup

Install the dependency:

npm install nuxt-bulma-slim

Add it to the modules section of nuxt.config.js:

{
  modules: [
    'nuxt-bulma-slim'
  ]
}

Or with custom options:

{
  modules: [
    [
      'nuxt-bulma-slim',
      {
        variablesPath: 'assets/scss/my-variables.scss',
        additionalPaths: ['assets/scss/component-styles.scss']
      }
    ]
  ]
}

Options

srcGlobs

This is an Array of glob paths. These paths can be absolute or relative to the Nuxt App srcDir option. The Array is passed to Purgecss' content option.

Default

srcGlobs = [
  '<Nuxt App srcDir>/layouts/**/*.vue',
  '<Nuxt App srcDir>/pages/**/*.vue',
  '<Nuxt App srcDir>/components/**/*.vue'
]

variablesPath

This is a String of a path to a .sass/.scss file that contains variables. Use this file to overwrite Bulma's variables.

Note that the path can be absolute or relative to the Nuxt App srcDir option and must be a .sass or .scss file.

For convenience this module checks if one of these files exists and automatically set the variablesPath option if you haven't set it already:

  • <Nuxt App srcDir>/assets/sass/variables.sass
  • <Nuxt App srcDir>/assets/scss/variables.scss

Default

variablesPath = null // if none of the above files exist, or ...
variablesPath = '<Nuxt App srcDir>/assets/sass/variables.sass' // or ...
variablesPath = '<Nuxt App srcDir>/assets/scss/variables.scss'

sassTempPath

This is a String of a path to the temporary .sass file that will be consumed by Nuxt.

Default

sassTempPath = '<Nuxt App rootDir>/.tmp/nuxt-bulma-slim.sass'

cssTempPath

This is a String of a path to the temporary .css file that will be consumed by Nuxt.

Default

cssTempPath = '<Nuxt App rootDir>/.tmp/nuxt-bulma-slim.css'

disablePostCSSWarnings

This is a Boolean to disable PostCSS warnings when compiling Bulma's SASS to CSS. If true, it will set this option in the Nuxt settings:

{
  build: {
    postcss: {
      plugins: {
        'postcss-custom-properties': {
          warnings: false
        }
      }
    }
  }
}

Check out the related issue.

Default

disablePostCSSWarnings = true

whitelist

This is an Array of whitelisted selectors and is given to Purgecss' whitelist option.

Note that html and body are already whitelisted by this module.

Default

whitelist = []

whitelistPatterns

This is an Array of whitelisted selectors based on RegEx and is given to Purgecss' whitelistPatterns option.

Default

whitelistPatterns = []

whitelistPatternsChildren

This is an Array of whitelisted children selectors based on RegEx and is given to Purgecss' whitelistPatternsChildren option.

Default

whitelistPatternsChildren = []

additionalPaths

This is an Array of additional .sass/.scss/.css paths that will be bundled along with the variablesPath and the Bulma build. This is useful if you want to bundle 3rd party libraries like Buefy that depend on Bulma.

Default

additionalPaths = []

How does it work?

In development mode (nuxt dev) a temporary .sass file is written with your defined variablesPath, the complete Bulma features, and any additionalPaths.

Temporary files are written to the Nuxt's rootDir in the .tmp folder.

This .sass file is then injected into the css Array of Nuxt. Since Nuxt can compile SASS, it will also automatically hot-reload your styles when you change your variables or additional paths content.

In production mode (nuxt build/nuxt start & nuxt generate), this module will bundle the SASS just like in development. Additionally it will compile the SASS to CSS.

This CSS is then run thru Purgecss to minify it, then it is written to a temporary .css file and injected into Nuxt's css Array.

Development

npm test

Run all the tests.

npm run test:watch

Re-run specific tests on file changes.

npm run lint

Lint all the code.

npm run dev

Run the ./example Nuxt App in dev mode (will use the whole Bulma library).

npm run build

Build the example Nuxt App (will only bundle Bulma features that are used).

npm start

Will start the example Nuxt App in production.

npm run upgrade

Will start npm-check to interactively upgrade the depeendencies.