Git Product home page Git Product logo

sass-butler's Introduction

SASS Butler

Stands by your side with plenty of features and mixins.

npm npm (scoped) GitHub package.json version GitHub Workflow Status (branch) GitHub Workflow Status GitHub Workflow Status GitHub code size in bytes

SASS Butler is a big collection of SASS mixins and functions.

Mixins and functions are unit tested via Jest and True. Unfortunately, it is not yet possible to create a coverage report.

Whats inside?

Visit https://sass-butler.kasimir.dev for full documentation.

Functions

Mixins

Installation

pnpm add @felix_berlin/sass-butler

npm i @felix_berlin/sass-butler

yarn add @felix_berlin/sass-butler

If you haven't already, install Sass.

pnpm add -D sass

npm i -D sass

yarn add -D sass

Requirements

This project uses the "new" Sass Module system. Therefore your build tool or taskrunner have to support Dart Sass 1.33.0 or above.

Sass support

Sass Compiler Support
Dart Sass
Lib Sass
Ruby Sass ⚰️

Version support

Your Dart Sass Version must be: >= 1.33.0

Usage

Import all at once or all individually

Single import of the used functionalities.

@use './node_modules/sass-butler/functions/first-of-list' as fol;

import all functions at once:

@use './node_modules/sass-butler/functions' as fn;

How to import

@use './node_modules/sass-butler/mixis/breakpoint' as breakpoint;

With sass-loader:

@use '~sass-butler/mixis/breakpoint' as breakpoint;

With webpack mix:

  .sass('resources/assets/styles/app.scss', 'styles', {
    sassOptions: {
      includePaths: ['./node_modules'],
    },
  })
@use 'sass-butler/mixis/breakpoint' as breakpoint;

Override module config

Some of the module comes with "global" config vars and maps (breakpoint mixin). This may be a problem since you can only overwrite once with with(). Here is an example how you can deal with it.

Redefine mixin or function default configs

Example how to use the breakpoint mixin with own default config:

Create a new file and load the breakpoint mixin from the node_modules with the @forward function. Similar to the @use function you can overwrite predefined vars with with().

// _custom-breakpoints.scss

@forward 'sass-butler/mixins/breakpoint' with (
  // Add your own breakpoints map
  $breakpoints: (
    'xxs': 375px,
    'xs': 568px,
    'sm': 768px,
    'md': 1024px,
    'lg': 1260px,
    'xlg': 1440px,
    'fhd': 1920px,
    'uhd': 2560px
  )
);

In the rest of your project you don't add the module via node_modules anymore but load the customized module _external.scss with @use.

// _my-module.scss

@use 'custom-breakpoints' as break;

.my-selector {
  @include break.breakpoint(lg) {
    padding: 12px 0 1rem 0;
  }
}

⚠️ Pay attention to the loading order when using redefined and package function/mixins!

Can't be compiled because the (package) breakpoint mixin is already loaded in mixins.scss.

@use 'sass-butler/mixins' as mx;
@use 'custom-breakpoints' as break;

This will work. Make sure to load the redefined module first.

@use 'custom-breakpoints' as break;
@use 'sass-butler/mixins' as mx;

Documentation

You can find the documentation at: https://sass-butler.kasimir.dev

The documentation is updated automatically with each commit on the master branch.

Build the docs locally

Run following command: npm run sassDoc

Contributors

sass-butler's People

Contributors

dependabot[bot] avatar felix-berlin avatar red-freak avatar renovate-bot avatar renovate[bot] avatar semantic-release-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.