sdb-dd-styles
v0.0.31
Published
CSS Styles
Downloads
8
Readme
Styles
Styling rules for Aura Design System with SCSS.
Setup
Installation
Install dependencies :
~ npm i
Start
Initiate watcher:
~ npm run start
attention: Make sure your node version is between 14 and 16
.
Folder structure
- settings/variables: files with global $variables.
- helpers: files with constructors of classes and placeholders.
- generic: files with generic rules, including definition of custom properties in
:root
. - elements: files with html elements styling.
- tools: files with additional utilities like @functions.
New files should be prefixed with _[name].scss
.
New files should be listed on index.scss
inside the corresponding folder.
Development
Use the provided index.html
to test the results in the browser.
Open the file and refresh when making any changes, as livereload is not available.
When adding new styles, ideally, each class should have a correspoding placeholder:
.flex,
%flex {
display: flex;
}
This assures the system can be use with both.scss
, .html
and .jsx
files.
Transforming
PostCss is set to transform .scss
files during build process.
To add more plugins and options, check postcss.config.js
file.
Commands
Others available commands are:
- linter: runs the linter.
~ npm run lint
- fixer: runs linter and fixs possible issues.
~ npm run lint:fix
- builder: builds the compiled
.css
files via node-sass.
~ npm run build
For more information about other commands, check the scripts
section in package.json
file.
Git Committs
When committing any changes, linter runs to make sure code is formatted correctly, via husky and lint-staged. If it throws an error, check the output and make sure to fix the issues.
Distribution
Release
Distribution is done with bitbucket pipelines.
When merging into master
branch, the following processes occurr:
- Installation of dependencies
- Linting of files
- Building of compiled files
- Release of package in npm.js
When pushing into the repository, the first two processes occur.
When creating a pull-request, the first three processes occurr.
It's possible to make a release without bickbucket pipelines by running:
~ npm run release:manual
For more information of all processes check bitbucket-pipelines.yml
file.
attention: Make sure to keep all unwanted files from distribution listed on .npmignore
file.
attention: When Creating a pull-request
, pipelines will trigger two times:
branch
pipepull-request
pipe
This is a limitation, so the branch
pipe can be stopped manually to avoid two pipes running at same time.
Cache
In order to increase the speed of bitbucket pipelines, a cache for node
is setup.
In case of installating new packages it's good to clean it beforehand, otherwise the install process will not contains the new packages, and the process might fail.
Versioning
It's automaticaly done by standard-version.
After updating package.json
inside the pipelines with the [new-version-number]
, a new commit is created in master
branch:
chore(release): 0.0.[new-version-number]
Publishing
It's done with Bitbucket's deploy-to-npm pipe.
Because it's pushing back to the repository it always creates an empty commit to trigger the publish.
After each publish, a new commit is created in master
branch:
[skip ci] Trigger from pipelines release step.
attention: Make sure always pull master
after each release so the two new commits are available locally.
Usage
Package
Install as a package:
~ npm install sdb-dd-styles --save
Import in your application:
/* styles.scss */
@import 'sdb-dd-styles';
CDN
Compiled version are accessible via the following links:
- non-minified: https://cdn.jsdelivr.net/npm/sdb-dd-styles/dist/styles.css
- minified: https://cdn.jsdelivr.net/npm/sdb-dd-styles/dist/styles.min.css
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sdb-dd-styles/dist/styles.min.css">
Implementation
Use as an .scss
extend:
/** styles.scss */
div {
@extends %flex;
}
Or CSS class in .html
or .jsx
:
<!-- index.html -->
<div class="flex"></div>
// index.jsx
<div class="flex"></div>