bootstrap-4-stylus
stylus port of bootstrap.css v4
Installation
Ensure stylus is installed globally
$ npm install stylus -g
info
A complete, fully functional and unaltered convert of bootstrap.css to stylus.
No learning curve and no repeats. build it how you want it or just use it as an easy way to exclude unused css.
bootstrap.css has been converted, broken down into smaller .styl
includes and the include files are named accordingly. within these include files are smaller sub-includes that can also be excluded.
npm
$ npm install bootstrap-4-stylus --save-dev
bootstrap-4-stylus can be used in the following ways when required as a module
build bootstrap-4-stylus
const b4s = require('bootstrap-4-stylus');
b4s.build(true);
if you chose true
your setup will be:
├─bootstrap.styl
├─bs4.js
├───dev
│ └───bootstrap-4-stylus
│ └───includes.styl
│ └───includes/*.styl
│ └───helpers/*.styl
├───dist
./bs4.js
contains a complete list of build functions.- Build variables can be edited via the
./bootstrap.styl
file. - include options can be edited in the in the
./dev/bootstrap-4-stylus/includes.styl
file as booleans ~ true/false. - include files are located at
./dev/bootstrap-4-stylus/includes/**/*.styl
./dist
is where your compiled bootstrap files will be saved- your baseDir within your files will automatically be updated to
./dev/bootstrap-4-stylus/
if you chose false
your setup will be:
├─bootstrap.styl
├─bs4.js
├───dist
- your baseDir within your files will remain as
./node_modules/bootstrap-4-stylus/
API
const b4s = require('bootstrap-4-stylus');
var options = {
compile:true,
compress:true,
compileSourceMaps:false,
compressSourceMaps:false,
toWatch: [
"./bootstrap.styl",
"./dev/bootstrap-4-stylus/includes",
"./dev/bootstrap-4-stylus/includes.styl",
"./dev/bootstrap-4-stylus/includes/helpers"
],
js:{
"bootstrap": true,
"bootstrapMin": false,
"bootstrapMap": false,
"bootstrapMinMap": false
},
backup: [
"./bootstrap.styl",
"./dev/bootstrap-4-stylus"
]
}
b4s.watch(options);
b4s.init()
b4s.compile()
b4s.compress()
b4s.compileSourceMaps()
b4s.compressSourceMaps()
b4s.getJs(options.js)
b4s.build(true);
b4s.versionCheck()
b4s.backupWin(options.backup);
b4s.backupLin(options.backup);
gulp API
v4
$ npm install gulp --save-dev
all of the functions included in the ./bs4.js
file can be called using gulp like so:
const gulp = require('gulp'),
b4s = require('bootstrap-4-stylus'),
options = {
compile:true,
compress:true,
compileSourceMaps:false,
compressSourceMaps:false,
toWatch: [
"./bootstrap.styl",
"./dev/bootstrap-4-stylus/includes",
"./dev/bootstrap-4-stylus/includes.styl",
"./dev/bootstrap-4-stylus/includes/helpers"
],
js:{
"bootstrap": true,
"bootstrapMin": true,
"bootstrapMap": true,
"bootstrapMinMap": true
}
};
function bs4Init(done) {
b4s.init()
done()
}
function bs4Compile(done) {
b4s.compile()
done()
}
function bs4Compress(done) {
b4s.compress()
done()
}
function bs4CompileSourceMaps(done) {
b4s.compileSourceMaps()
done()
}
function bs4CompressSourceMaps(done) {
b4s.compressSourceMaps()
done()
}
function bs4GetJs(done) {
b4s.getJs(options.js)
done()
}
function bs4VersionCheck(done) {
b4s.versionCheck()
done()
}
function bs4Build(done) {
b4s.build(true)
done()
}
function bs4Watch(done) {
b4s.watch(options)
done()
}
function bs4BackupLin(done) {
b4s.backupLin(options.backup)
done()
}
function bs4BackupLin(done) {
b4s.backupWin(options.backup)
done()
}
exports.bs4Init = bs4Init;
exports.bs4Compile = bs4Compile;
exports.bs4Compress = bs4Compress;
exports.bs4CompileSourceMaps = bs4CompileSourceMaps;
exports.bs4CompressSourceMaps = bs4CompressSourceMaps;
exports.bs4GetJs = bs4GetJs;
exports.bs4VersionCheck = bs4VersionCheck;
exports.bs4Build = bs4Build;
exports.bs4Watch = bs4Watch;
exports.bs4BackupLin = bs4BackupLin;
exports.bs4backupWin = bs4BackupWin;
exports.default = bs4Watch
- An example gulpfile.js can be found at
/examples/gulpfile.js
bower
bower:
$ bower install bootstrap-4-stylus --save-dev
your setup will be:
├─bootstrap.styl
├─includes.styl
├─index.js
├─app.bat
├───cmd
├───dist
├───example
└───main.js*
├───includes
└───helpers
$ node index.js
will by default compile:
[
"./dist/bootstrap.css",
"./dist/bootstrap.min.css"
]
The file ./example.main.js
has a complete list of functions available to you. simply move this file into the base dir ./
and you will have the same functionallity as the npm users.
$ node main.js
- as with the npm users, you also have access to all the other functions and gulp usage.
- The default app options can be configured in
/lib/config/index.json
{
"main":{
"compile":{
"enable":true,
"command":"-o ./dist"
},
"compress":{
"enable":true,
"command":"-c -o ./dist/bootstrap.min.css"
},
"compileSourceMaps":{
"enable":false,
"command":"-m -o ./dist"
},
"compressSourceMaps":{
"enable":false,
"command":"-c -m -o ./dist/bootstrap.min.css"
}
},
"options":{
"compile":true,
"compress":true,
"compileSourceMaps":false,
"compressSourceMaps":false,
"toWatch":[
"./bootstrap.styl",
"./includes.styl",
"./includes",
"./includes/helpers"
]
}
}
default stylus command
open a console and type:
$ stylus bootstrap.styl -o ./dist
$ stylus bootstrap.styl -c -o ./dist/bootstrap.min.css
$ stylus bootstrap.styl -m -o ./dist
$ stylus bootstrap.styl -c -m -o ./dist/bootstrap.min.css
windows users
double click the ./app.bat
file for an interactive task runner command line app.
done.