GithubHelp home page GithubHelp logo

davidcmoulton / pattern-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elifesciences/pattern-library

0.0 2.0 0.0 3.37 MB

Pattern library driving https://elifesciences.org, the eLife journal.

Home Page: https://ui-patterns.elifesciences.org/

License: MIT License

CSS 16.44% JavaScript 35.80% Shell 0.08% PHP 26.00% Ruby 0.01% HTML 21.67%

pattern-library's Introduction

Note

This pattern library uses as its starting point https://github.com/pattern-lab/patternlab-php with HEAD at sha e52ced8551000b7c6b97a01f419e2af8a07e2fd1

Quickstart

This sets up PatternLab to generate the html from mustache templates, and Gulp to handle transformation of scss to css, and other various build-related tasks. Note that artefacts generated from running Gulp are inputs for the generation of PatternLab files, so Gulp needs to run before PatternLab. When developing, it’s recommended to run watch tasks for both, which will take care of this.

1. Dependencies

You'll need:

Then install compass: gem install compass

2. Automatic setup

From the root directory run

$ ./bin/dev

This will install and run the commands needed to get started, starting a web server on port 8889. If you need a custom port pass this as the first argument:

$ ./bin/dev 1234

This will run on localhost:1234

You should be good to go, open your browser and you will see the pattern lab.

Manual setup

1. Set up PatternLab

  • Clone pattern library: git clone [email protected]:elifesciences/pattern-library.git
  • Create the public folder: cd pattern-library && mkdir public
  • Copy dependencies: cp -r ./core/styleguide ./public/

2. Set up and run Gulp

  • if you have not used gulp before, then install the gulp cli globally with npm install --global gulp-cli
  • install required npm packages with npm install
  • run gulp to build the css & js files.
  • then run gulp watch to watch for changes to files or do both in one fell swoop with gulp && gulp watch (the watch task on its own will not compile your assets until a file is changed).
  • run gulp test --mocha-grep=something to pass the --grep option to mocha and run a subset of tests.
  • if generating files intended for website production, invoke with the production flag, like this: gulp --environment production. The minifies css & js files.

3. Generate PatternLab

To run a one-off generation of the patterns, it's php ./core/builder.php -g

Alternatively to set up a watch task for pattern generation, run php ./core/builder.php -w

4. Verify the setup

The static files defining the patterns should now be available in the public directory.

Verify the generated static site by serving the public folder locally. One quick and dirty way to do this is to run the built in PHP server in the public folder:

  1. Open a new terminal
  2. cd into the public directory
  3. run the webserver php -S localhost:8889
  4. in a browser go to http://localhost:8889 and verify you can see the generated patterns.

Using patterns

For patterns that are being exposed as resources (ie the Mustache template can be used in an application), there is a YAML file located alongside the template. This contains details of any CSS files that it requires, and a JSON Schema that documents what input is expected.

You can run bin/validate, which checks all data files for a pattern against the schema.

There is also a list of js file dependencies for each pattern, but individual js files have not yet been implemented and so these lists are currently all empty.

Notes

All assets paths in Mustache templates must be wrapped in {{#assetRewrite}}, which allows implementations to rewrite the path for cache-busting purposes. The path must also be prepended by {{assetsPath}}.

pattern-library's People

Contributors

davidcmoulton avatar gablaxian avatar thewilkybarkid avatar stephenwf avatar giorgiosironi avatar scottgemmell avatar bluerezz avatar nlisgo avatar

Watchers

James Cloos avatar  avatar

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.