Atlas is living style-guide, pattern library, guidelines and documentation static site generator with extensive styles monitoring and Sass components reports. It generates documentation from markdown files and documentation comment in Mustache style guide.
It is opinionated. Because it is, probably, impossible to cover all cases in CSS/Sass. It designed primarily as "style-guide driven development" tool with focus on splited files approach and incapsulated components with normative Sass imports structure.
blazing fast thanks to Mustache and Marked. It primary designed as development platform;
supports incremental builds, so only changed pages could be updated;
could be setup with live reload or "hot" reload;
small list of dependencies (Mustache, Marked, PostCSS, CSSStats, ImportsGraph, D3 and Lodash parts);
all internal templates and styles could be overwritten on project level;
could be used as simple guide docs generator;
Hologram compatible (without front matter section);
standards compatible. If needed all docs sources could be parsed as standard markdown and compiled to standard HTML to be used in different tool like Dash or other platforms. No incompatible syntax or constructions is used.
files where regular markdown could be placed.
comes with simple playground, so code examples could be live-edited, previewed and copy-pasted;
consists of 3 main types of pages - component, guide and reports and could be expanded to many different types;
navigation tree copy project tree, to ease of orientation and handling huge components library;
components tree filtering and folding;
local variables, internal and external dependencies;
compatibility with declared constants (if they declared);
autogenerated Styleguide page based on project constants;
Support regular markdown files in components folders and process it as guideline pages.
table of contents and permalinks to sections;
do/not-do colorized examples.
cross components dependencies graph;
sass components files sizes;
project statistical reports:
file sizes comparison with raw and gzip;
data uri size and used data;
specificity graph and heaviest, longest selectors list;
rule set size and heaviest, empty rule sets list;
prefixed selectors, universal selectors, id selectors and important rules lists;
total vs unique declaration of style and metric properties;
How to make your mustache look thicker
unique media queries used.
See example guideline page or this repo gulp to get the idea how live reload and incremental builds could be set upped.
for incremental development builds, where it is not required to have extensive heavy-weight statistic.
Atlas v1.4.1 will search configuration in several places (Please see docs here ). Atlas v 2.0.0 require explicit configuration in
You could place it wherever you want and target with:
or with rawConfig object if you call atlas from js:
different configuration for different brands
Suppose you store brand configuration into
than you could build guide like this:
As the next step you, probably, want to add your project CSS and JS to render components examples properly. To make this happen you need to add
to the config, with paths to the templates in your project space:
add links to your project CSS/JS. Ex:
project-footer.mustache
Note, that paths should be related to generated HTML, no matter where templates are stored. This is simple include that will be incorporated into resulted html.
All templates and partials in Atlas could be overwritten. Please see this repo views folder to get list of all templates and partials.
{string} – path to scss files that documented. It is not mandatory that it should be scss root, it could be any folder, but in this case you need to additionaly provide
{string} – path to generated files folder.
{string} – path to generated CSS. Used for statistical reports.
{string} – path to root of SCSS files. Optional. Used for generate statistical reports. It should be used if
is different from scss root. If not defined –
will be used. Proper path to root scss files needed to generate dependencies graph.
scssAdditionalImportsArray
{array} – array of additional sass imports, if they used. Needed for statistical reports and styleguide auto generation.
{array of strings} – ['component', 'container'] prefixes that used for components and containers on project. It used to properly guess component types in component structure info (in footer). Ex:
{regexp} – CSS files that would not be processed in statistical reports.
{regexp} – Sass files that would not be processed in statistical reports.
{regexp} – directories that will be excluded from doc sets.
{bool} – copy internal Atlas assets (CSS and JS) to generated folder on each start. This would be usefull if you use completly custom style for guide and support it separatly.
{bool} - create destination directory if it is not exist. Default if
{string} - path to custom markdown file that will be used in index.html. Otherwise atlas try to find in guide src and in the root of the project.
– use this field to use your own templates for guide generation.
– use this field to use your own partials and includes.
– this field is used to autogenerated styleguide and projects variable usage panel in components footer. It based on prefix system.
{string} | [{string}] – path or array of paths to file/s with project constants. Paths should be relative to project root.
{string} – prefix used to identify color variables. Ex:
etc. If not defined it would be skipped.
{string} – prefix used for font families constants. If not defined it would be skipped.
{string} – prefix used for font scaling constants. If not defined it would be skipped.
{string} – prefix used for spaces system. If not defined it would be skipped.
{string} – prefix for animation/transition presets. If not defined it would be skipped.
{string} – prefix for layering/shadows system. If not defined it would be skipped.
{string} – prefix for used breakpoints. If not defined it would be skipped.
{string} - custom name of the project. Otherwise package name will be used.
Atlas like Vim consists of two functions - beeping and corrupting files. But with minor difference. It generates guide and generates reports. You need to document code to make it "beeping" and provide config to make it generate files.
In this section we need to cover 2 topics - documenting and reports configuration.
Add this comment to the scss file and it file appears as component page.
Inside this comment regular markdown syntax would used, so any valid markdown will work here.
Note: Please avoid some tricky markdown construction, because
super fast, but with this comes not great smartness.
Atlas extends markdown code block "fences" notation with custom type (just like Hologram) --
. That render component playground instead of code-example. This keeps documentation compatible with regular markdown.
To create component example you need to add code-block with
"fences" become regular code-block:
All "_" in code block "fences" will be removed, but original "fence" will be added as CSS-class, so you could use it to style code by your needs. Atlas by default style 2 class . This could be used in guidelines. To inline some resources like svg icons, inlined styles etc. you could use This helper use path to file from your project root. Virtually any file could be inlined. Guideline/Documentation page The horseshoe mustache Simply put regular markdown file to components tree and they automatically become part of the atlas. Regular development flow could be organized in this way – build all guide pages on start and incrementally rebuild pages on file changes: See example guideline page or this repo to get the idea how live reload and incremental builds could be set upped. Complete Atlas generation Due to time efforts reports not generated in regular flow. To generate reports you need to call Autogenerated styleguide based on project constants Atlas could automatically generate styleguide page and warn if this constants not used in component statistic if project constants is setup. This set up could be a tricky part, because it required full sass compilation and has some limitations. First you need to use constants in simple form. Ex: Lists, maps or functions is not supported. Second. If you use additional imports array in sass, please, add it to config first "scssAdditionalImportsArray": ["path/to/additional/sass/files"] Other steps should be simple: add path to constants manifest file add prefixes that is used for different types of constants After that styleguide page and components stat hints would be generated beside components regular building cycle. I need to remove unneeded graphs, info, features etc. How to do this? The most robust way to do this is extend templates on project level and remove views that responsible for that. I build dependency graph but it has too much duplicate imports since each our resulted file include the same files. To clean up the graph you could add duplicated files into scss ignore list. To do this put regexp to We have 2 document comments in scss file, but only first is shown in documentation. This is done intentionally. It all designed for 1 component 1 scss file structure. Otherwise it is very hard to keep compoents readable and supportable. You are welcome for ideas, help and of course code contributing. Please see CONTRIBUTING for more details. Copyright © 2019, D. Nechepurenko. Published under MIT license.
Comments
There are no comments for this post "GitHub - dimanech,atlas-guide: Atlas is living styleguide pattern library static site generator with extensive CSS monitoring and components info that could be used virtually with any scss,css project.". Be the first to comment...
Add Comment