Webpack / Happypack / Gulp / Postcss / Stylus / Nunjucks / Babel,Rebuild super fast
5
4
webpack
Happypack``Happypack
Happypack``webpack loader``happypack loader
{
test: /\.jsx?$/,
loader: 'happypack/loader?id=js'
}
new HappyPack({
id: 'js',
threads: 2,
loaders: ['babel?cacheDirectory=true'],
verbose: false
})
Happypack
loaderthreads
const pool = HappyPack.ThreadPool({ size: 6 })
new HappyPack({
id: 'js',
threadPool: pool,
loaders: ['babel?cacheDirectory=true'],
verbose: false
})
Happypack
buildrebuild
HappypackHappypack
buildrebuild
dll
package.json``dependencies
dependenciesHappypackwatch
monaco-editor
-S``-D``npm i -D monaco-editor``devDependencies``dependencies
dll``.rabbit
builder
builderbuilder
Stylus / Postcss
stylus/css
stylus utils naming
[_]<Namespace>-<ClassName>[-<ChildClassName>][--<Modifier>]
_
Namespace
.c-btn
.u-fill
lib/
u
stylus @import``@require
@require****@import
@import****css
@import "index.css"
css@importcss
@import "index.css"
stylstylus node stylus path path path
function stylusOption() {
return {
include: env.paths,
}
}
@import "module"
stylus
module.styl
module/index.styl
stylus @media
@media mobile
@import "mobile"
stylusglob*
styl
@import "component/*"
mixinu-grid``u-grid-export
u-grid-export(
$gutter = 1.5rem,
$bRow = "row",
$bGrid = "grid",
$isFlex = true,
$isMixinWidth = false,
$isExportRow = true,
$isExportGrid = true,
$isExportGridOffset = false,
$isExportGridPull = false,
$isExportGridPush = false,
$isExportGridLast = true,
$isLastMixinWidth = false,
$mGridLast = "last"
)
// Export Row basic.
if $isExportRow
.{$bRow}
u-row $gutter $isFlex
// Export Grid basic.
if $isExportGrid
.{$bGrid}
u-grid $gutter $isExportGridLast $isFlex
// Export Grid from right.
if $isExportGridLast
.{$bGrid}-{$mGridLast}
u-grid $gutter $isExportGridLast
@require "u:grid"
@require "u:grid[]"
[]``u-<namespace>-export
@require "u:grid[$isFlex:true,$isExportGridLast:false]"
1:1
//@Todos
rabbit.json