Extends sass built-in modules with additional useful functions.
Add sass-extend to your scss project and import the modules you want to use using @use
, just like native sass modules.
If you are using native sass modules within the same namespace, use an alias for sass-extend to prevent namespace conflicts.
These are the modules included in sass-extend.
@use "sass-extend/string";
Function used to replaces a substring in a string.
string.replace($string, $search, $replace: "")
The following snippet shows an example on how to use it.
@use "sass-extend/string";
$string: "Lorem ipsum";
$replaced-string: string.replace($string, "ipsum", "dolor sit"); // Lorem dolor sit
To use with an unquoted string, you need to interpolate it.
@use "sass-extend/string";
$hex: #f5f5f5;
$hex-digits: string.replace(#{$hex}, "#", ""); // f5f5f5
@use "sass-extend/math";
Function used to remove the unit from a CSS value (number).
math.strip-unit($number)
The following snippet shows an example on how to use it.
@use "sass-extend/math";
$strip-unit: math.strip-unit(16px); // 16
It is also possible to import all modues at once. To do so, import sass-extend
directly.
@use "sass-extend";
All modules will be namespaced with sass-extend
instead of the module category name. It is possible to change the namespace adding an alias to the import.
@use "sass-extend" as se;
This repository includes a demo used to test the functions. Run the demo using the following command. The output will be logged in the terminal.
npm run demo
Guidelines for working in this repository.
Install dependencies.
npm install
This project uses Prettier to format the code. To format all files, run the following command.
npm run prettier
This project uses Stylelint to lint the scss. The settings is based on stylelint-config-standard-scss
. To run the lint, run the following command.
npm run stylelint
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.