// Install
yarn install
// Compile all components and generate all assets
build:styleguide:dev
// Open styleguide at localhost:3000 & watch for changes
start:styleguide
// This will get rid of superfluous javascript files automatically generated by webpack
// as well as minify the CSS
prepare:prod
If you are to add certain features to this styleguide, consider adding your scripts in the config/helpers/ folder.
Assets zip and SASSDOC generation scripts, for instance, are located there.
At the root of the project, inside the config
folder, the config.js file contains
a "paths" object with folder names of all major folders used throughout the styleguide and its documentation.
paths : {
configFolder: "config",
tokensFolder: "design-tokens",
generatedTokensFolder: "design-tokens-generated-config",
...
}
Use nodejs's "path" module to build a path to an asset.
For convenience, a local path object was created inside the webpack.config.js
and docs.config.js
files.
See adding a component for more info.
Find the webpack.config.js file at the root of the project, find CopyPlugin
inside the plugins
array and add your resources.
Resources can be added by defining a glob pattern or as single files.
The from
property are the files to copy.
The to
property is the output path, relative to the public
folder.
new CopyPlugin({
patterns: [
{ from: PATHS.MEDIA_PATH, to: config.paths.mediaFolder },
{ from: PATHS.FONTS_PATH, to: config.paths.fontsFolder },
{ from: PATHS.LIBS_PATH, to: config.paths.libsFolder },
{ from: path.join(config.paths.nodeModules, "prismjs/themes/prism.min.css"), to: 'sassdoc/assets/css/prism.min.css' },
{ from: path.join(PATHS.JS_PATH, "styleguide-overrides"), to: path.join(config.paths.scriptsFolder, "styleguide-overrides") }
]
})
Webpack plugin page.
All resources have to be added to the public
folder through webpack. For more info or a refresher on that see the webpack section.
All resource paths are relative to the public
folder.
Resources | |
---|---|
Javascript |
Go to fractal.config.js, find the myCustomisedTheme
constant and add the needed resources inside the script tag.
|
CSS |
Go to fractal.config.js, find the myCustomisedTheme
constant and add the needed resources inside the styles tag.
|