Giter VIP home page Giter VIP logo

fractal's Introduction

Fractal



Fractal is a tool to help you build and document website component libraries and design systems.

Read the full Fractal documentation

Introduction

Component (or pattern) libraries are a way of designing and building websites in a modular fashion, breaking up the UI into small, reusable chunks that can then later be assembled in a variety of ways to build anything from larger components right up to whole pages.

Fractal helps you assemble, preview and document website component libraries, or even scale up to document entire design systems for your organisation.

Check out the documentation for more information.

Requirements

You'll need a supported LTS version of Node. Fractal may work on unsupported versions, but there is no active support from Fractal and new features may not be backwards compatible with EOL versions of Node.

Getting started

Install into your project (recommended)

npm install @frctl/fractal --save-dev

Then create your fractal.config.js file in the project root, and configure using the official documentation.

Then you can either run npx fractal start to start up the project, or create an alias under the scripts section in your package.json as a shortcut.

e.g.

"scripts": {
    "fractal:start": "fractal start --sync",
    "fractal:build": "fractal build"
}

then

npm run fractal:start

Installing globally

npm i -g @frctl/fractal

This will also give you global access to the fractal command which you can use to scaffold a new Fractal project with fractal new.

The downside is that it's then difficult to use different Fractal versions on different projects.

This option is not recommended until a global Fractal install is capable of offloading to a project specific version.

Examples

  • Official demo (using Nunjucks): demo.fractal.build

    Repository: demo.fractal.build

  • Official examples are available in the examples directory. Although we primarily use them for developing and testing Fractal, they probably are a great resource for users as well.

  • Additional public examples can be found on the Awesome Fractal repo.

Contributing

Fractal has an active group of contributors but we are always looking for more help. If you are interested in contributing then please come and say hi on Fractal's Discord server.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Reporting issues & requesting features

We use GitHub issues to track bugs and feature requests. Thank your for taking the time to submit your issue in one of our repositories.

If you rather have a question, please ask it on our Discord server.

Submitting pull requests

We will always welcome pull requests on any of the frctl organisation repositories. Please submit PRs against main branch with an explanation of your intention.

We use conventional commits, which means that every pull request title should conform to the standard.

Development

This repository is a monorepo managed by Lerna. There is only one lockfile in root. This means that all packages must be installed in root, manually added to the packages' package.json files and then bootstrapped with lerna.

To do some work, run the following commands in root:

  1. npm ci
  2. npm run bootstrap

Testing

Fractal is a project that evolved rapidly and organically from a proof-of-concept prototype into a more stable, mature tool. Because of this it's currently pretty far behind where it should be in terms of test coverage. Any contributions on this front would be most welcome!

Existing tests can be run using the npm test command.

Contributors ✨

Thanks goes to all wonderful people who have helped us out.

Contributions of any kind welcome!

License

MIT

fractal's People

Contributors

13twelve avatar ahebrank avatar allmarkedup avatar arnoud-dv avatar baerkins avatar chapabu avatar dependabot[bot] avatar dkhuntrods avatar douglasf avatar fvanderwielen avatar greenkeeper[bot] avatar justafish avatar k-utsumi avatar khawkins98 avatar lebenleben avatar levito avatar mihkeleidast avatar mischah avatar mjomble avatar nchase avatar paulrobertlloyd avatar pgrimaud avatar rchavik avatar schleuse avatar scottmorris avatar sebimoe avatar snyk-bot avatar svenheden avatar tomdavies avatar vincevince1006 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fractal's Issues

Updating fractal.js while fractal is running quits fractal

If Fractal is running, saving a change to fractal.jscauses Fractal to stop with

✘ ReferenceError: hasChanged is not defined

Steps to reproduce:

  1. cd into a Fractal project directory
  2. start Fractal with fractal: the Fractal server starts and the fractal ➤ prompt appears
  3. edit the fractal.js file, and save it
  4. notice that fractal has stopped, saying ✘ ReferenceError: hasChanged is not defined
    screen shot 2016-03-07 at 21 38 45

Ordering folders

Folders can't be reordered using numbers in their folder names, but files can.

Changes needed to support React components properly

  • support non-component preview layouts. Reference by path?
  • support for requireing and converting JSX files (https://babeljs.io/docs/usage/require/)
  • defer rendering of preview layout to adapter, if renderLayout method is defined
  • prevent .config.js files from being parsed as components
  • Figure out how to support FE integration
  • ability to customise UI labels to match the terms that React users would typically use
  • smarter reloading/invalidating of view cache

Improve initial boot performance

Startup seems too slow at the moment. Reducing dependencies should help, need to get some profiling running to figure out exactly what is causing the lag.

notes .md files not encoding numbers in an HTML entity correctly in a code example or block

if I add a note that needs to demo how to include a component, I will need to include something like

{{render @hoff-knight2000}}

However doing this alone renders the components code within the markdown file

If I put this in a code block it renders the components code in the codeblock

If I replace { with &123; and } with &125; this works unless it's in a codeblock or blockquote where the numbers don't rendered properly - which is pretty crappy.

Bug: Component preview layout only renders if not in the compound component folder

Given a component (hr.hbs):

<hr>

with the following config (hr.config.yml):

label: "Horizontal rule"
notes: |
  The `hr` element represents a paragraph-level thematic break, e.g., a scene change in a story, or a transition to another topic within a section of a reference book.
preview: "@preview"

and the following preview layout (_preview.hbs):

<p></p>

{{{yeild}}}

<p></p>

A component is only rendered if the preview layout is in a folder above the compound folder. So this:

├── components
│   └── hr
│   │   ├── _preview.hbs
│   │   ├── hr.config.yml
│   │   ├── hr.hbs

doesn’t work, but this:

├── components
│   ├── _preview.hbs
│   └── hr
│   │   ├── hr.config.yml
│   │   ├── hr.hbs

does. Is this the expected behaviour?

Feature request: Greater flexibility on where project configuration options need to be stored

This can certainly be filed under ‘nice to have’, but needing a fractal.js file in the root of a project sits a little uncomfortably with me; especially as it mainly consists of configuration options, which seem better suited to being in a JSON/YAML file of some description (assuming no JavaScript additions are needed).

This niggle is further reinforced having recently spotted cosmiconfig, a project whose philosophy seems similar to that of fractal. This package allows projects to be unopinionated about how and where configuration is provided (be it a .fractalrc file, inside package.json, a fractal.config.js file, --config options within the CLI etc. etc.). Worth a look!

'fractal new project-name' not generating anything

Hi, this looks like a great project, but so far I'm getting no output from the fractal new command. I've tried reinstalling Fractal globally and it hasn't made any difference. Am I missing something? I've copypasted my Terminal output below.

 10:41:44  ...code/planetary/fractaltests  ⬡ system 
👉 fractal new project-test

⚑ Creating new project.... just a few questions:

? What's the title of your project? Project Test
? Where would you like to keep your components? components
? Where would you like to keep your docs? docs
? What would you like to call your public directory? public
? Will you use Git for version control on this project? Yes

 10:42:01  ...code/planetary/fractaltests  ⬡ system 
👉 ll

 10:42:03  ...code/planetary/fractaltests  ⬡ system 
👉

Any help much appreciated!

parent config file is included within a child component that has it's own config file

I have a group of components - hoff-hair, hoff-shades, hoff-tan that are in a parent folder hoff
I have a hoff.config.yml that has overall data for all of the child components
If I create a separate config file for hoff-hair - hoff-hair.config.yml this gets outputted in the context data followed by the data within hoff.config.yml

Is there a way to tell the component when it's 'all by itself' to only use the config.yml file that's within the folder?

Missing documentation

API docs

  • overview
  • sources
  • collections
  • components
  • variants
  • assets

Plugins & commands

  • overview
  • writing plugins
  • plugins list
  • creating bespoke commands

Web UI

  • CLI and non-command line configuration options
  • themes & colour schemes

Guides

  • Generating dynamic data
  • Working with build tools/assets
  • Using Fractal as a dependency in projects

Other

  • Naming things
  • Glossary (incomplete)

Upload styleguide to subfolder

I'd like to upload the built styleguide to a subfolder on my server (instead of having to make a subdomain for every demo) Is there a way to configurate the web UI plugin or fractal to make the URLs relative instead of absolute?

context data doesn't travel

Ok, I've got a set of patterns that are in a folder /hoff which are each in their own folder /hoff/hoff-title, /hoff/hoff-paragraph and /hoff/hoff-media. These patterns pull in data from a .yml file that's in the parent folder (/hoff).
As part of our pattern library we are also showing certain generic pages. If I have the page in a new folder /baywatch and each pattern in /hoff is included the context data gets pull in when making the page (which is ace) but when going to the dropdown of /baywatch the context data isn't there.

Is there any way of getting this showing up? Maybe even with multiple data files too?

Question: Can I read YAML front matter values inside a document’s body?

Given the following documentation:


---
title: My Fabulous UI Toolkit
colors:
  primary:
    $color-darkgreen: "#166729"
    $color-darkgrey: "#585958"
    $color-pebble: "#dedbd2"
  shades:
    $color-palegreen: "#e5f0df"
    $color-lightgrey: "#ccc"
    $color-linen: "#f3f1ed"
    $color-light: "#fcfbf9"
  accents:
    $color-brightgreen: "#8dc63f"
    $color-magenta: "#d70171"
    $color-mustard: "#fbb531"
    $color-red: "#b40a16"
    $color-blue: "#3199d8"

---
This UI toolkit is a highly-modular design system for rapid web page development.

Can I access the additional front matter values inside the document body, for example:

## Colours
{{#each colors}}
    <ul class="palette">
        {{#each this}}
            <li class="palette__color" style="background-color: {{ this }}">{{@key}}</li>
        {{/each}}
    </ul>
{{/each}}

This particular example is taken from a port of some documentation written for Fabricator, but it’s a useful feature.

Bug: TypeError: Handlebars.create is not a function

When adding notes to a component, thus:

status: ready
notes: Use `block` to segregate content into a grid. Each child `block__item` will alongside siblings at larger breakpoints, its width dictated by the number of siblings in a block.

Fractal throws an error: TypeError: Handlebars.create is not a function and the list of components in the navigation disappears.

Bug: order value in component configuration not respected

I have the following components, with the order value set in their respective configs as follows:

a: 1
cite: 6
dfn: 8
abbr: 9
data: 10
code: 12
b: 19
br: 22

Yet, the components are displayed in the following (seemingly random) order in the UI:

a
b
br
cite
dfn
abbr
code

Here is an example config file:

label: "Abbreviation"
order: 9
notes: |
  The `abbr` element represents an abbreviation or acronym, optionally with its expansion. The `title` attribute may be used to provide an expansion of the abbreviation.

What’s going on? (This is just a subset of the components I’m trying to order, BTW).

Allow for template include functions to call arbitrary paths

I wish to use a path within a nunjucks {% include %}, as allowed by that templating language. However, Fractal only allow authors to use a @handle. Reason: I wish to keep all SVGs within their own folder within my assets directory, and then include them inline.

From @allmarkedup:

no that is not currently possible… arbitrary includes would be quite a nice feature but it would have to be template-engine specific. Open and issue and I will try to get to it!

component / documentation show hide toggle

As my component library gets larger - I think it would be a "nice-to-have" if we could toggle the navigation to show/hide the components / documentation (anything else that goes there)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.