Common Assets
Summary
This packages hold assets for Dendron Views. During the build step, assets from this package are concatenated and copied into NextJS Template and Dendron Plugin Views (TODO: need to refactor logic from dendron-plugin-views
, currently assets are being built separately there).
Details
- this will copy over
- antd styles
- prism styles
- primary fonts
- katex fonts
- misc javascript
Layout
- common-assets
- assets/
- css/
- prism/
- dark.css
- light.css
- antd/
- dark.css
- light.css
- ...
- prism/
- css/
- assets/
LifeCycle
Build Styles
antdThemes
prismThemes
katex
fontello
writeStyles(...)
copy(katex)
copy(topRooto)
copy(fontello)
gulp("assets/js/*.js")
gulp("assets/js/*.js")
Sync
-
User runs
yarn setup
in Dendron monorepo -
The last step after all packages are build, is running
dendron dev sync_assets --fast
- this runs
DevCommands.SYNC_ASSETS
command in ../packages/dendron-cli/src/commands/devCLICommand.ts (Private)
// Takes assets from different monorepo packages and copies them over to the plugin syncAssets { // sync assets to plugin syncStaticAssets syncStaticAssetsToNextjsTemplate }
- syncStaticAssets: ../packages/dendron-cli/src/utils/build.ts (Private)
pluginStatic = "plugin-core/assets/static" ensureDir(pluginStatic) emptyDir(pluginStatic) copy("common-assets/assets/css", pluginStatic) copy("common-assets/build/assets/css/font", pluginStatic + "css/themes/fonts") copy("common-assets/assets/js", pluginStatic + "js) copy("plugin-views/build/static/css", pluginStatic + "css") copy("plugin-views/build/static/js", pluginStatic + "js")
- syncStaticAssetsToNextjsTemplate: ../packages/dendron-cli/src/utils/build.ts (Private)
templateAssetPath = "nextjs-template/public/assets-dendron" ensureDir(templateAssetPath) emptyDir(templateAssetPath) copy("common-assets/build/assets", templateAssetPath) copy("common-assets/build/top", "nextjs-template/public")
- this runs
Style changes
When doing changes inside ../packages/dendron-plugin-views/src/styles/scss (Private) or ../packages/nextjs-template/styles/scss (Private) you must bring them back into the source-of-truth of these styles which is in ../packages/common-assets/styles/scss/ (Private). Git then will recognize the changes in the latter location since the former two locations are gitignored.
Related
Backlinks