Giter Club home page Giter Club logo

cityofnewyork / patterns-create-react-app Goto Github PK

View Code? Open in Web Editor NEW
3.0 18.0 0.0 10.84 MB

Sample application using React Scripts (Create React App) with the NYCO Common Agency Patterns library integration. Maintained by @nycopportunity

Home Page: https://nycopatterns.cityofnewyork.us

Shell 1.30% HTML 13.84% JavaScript 53.72% SCSS 31.14%
react react-scripts create-react-app tutorial demonstration nycopportunity nycopatterns documentation sample

patterns-create-react-app's Introduction

This project was bootstrapped with Create React App and integrated the NYCO Patterns library as a dependency without ejection. This integration is compatible with React Scripts v3.4. Version 4 of React Scripts introduces breaking changes to asset include paths.

React Scripts + NYCO Patterns integration

$1 Install dependencies after initializing a React Project.

npm install sass @nycopportunity/patterns @nycopportunity/patterns-framework@^0.2.4

$2 Use the SASS_PATH environment variable to configure your include paths. Initialize or add to your .env the following:

SASS_PATH=src:node_modules/@nycopportunity:node_modules/@nycopportunity/patterns/src:node_modules/@nycopportunity/patterns-framework/src:node_modules/animate.scss

$3 Change the index.css to index.scss and set the library's asset paths variables to use the local project's path.

$cdn: '/src/';
$path-to-fonts: 'fonts';
$path-to-svg: 'svg';

$4 Import patterns into the main stylesheet. The following line will import everything. View this repository's index.scss file to browse the import configuration options.

@import '~@nycopportunity/patterns/src/scss/imports';

$5 Copy distributed assets from the NYCO Patterns framework into the src directory of the project:

./node_modules/@nycopportunity/patterns/dist/fonts > ./src/fonts
./node_modules/@nycopportunity/patterns/dist/svg > ./src/svg
./node_modules/@nycopportunity/patterns/dist/icons.svg > ./src/icons.svg

$6 Run npm start to begin development.


Notes:

  • The configuration above is largely dependent on what patterns in the library you will be using in your project. The above steps are based on the usage of all NYCO Patterns stylesheets.

  • Node Sass can be used in place of Dart Sass, however, future pattern libraries will be migrating to Dart Sass.

  • The latest version of the framework may be used but not all of the patterns in the library are be compatible with it.

  • Below is a breakdown of the include paths for the SASS_PATH variable. Not all of them are required if only a few of the patterns are being used.

src
node_modules/@nycopportunity
node_modules/@nycopportunity/patterns/src
node_modules/@nycopportunity/patterns-framework/src
node_modules/animate.scss

Happy Coding!


The Mayor's Office for Economic Opportunity

The Mayor's Office for Economic Opportunity (NYC Opportunity) is committed to sharing open source software that we use in our products. Feel free to ask questions and share feedback. Interested in contributing? See our open positions on buildwithnyc.github.io. Follow our team on Github (if you are part of the @cityofnewyork organization) or browse our work on Github.

patterns-create-react-app's People

Contributors

devowhippit avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.