{"id":14976358,"url":"https://github.com/jquintozamora/react-typescript-webpack2-cssmodules-postcss","last_synced_at":"2026-03-06T13:04:45.470Z","repository":{"id":38866584,"uuid":"80755170","full_name":"jquintozamora/react-typescript-webpack2-cssModules-postCSS","owner":"jquintozamora","description":"Simple Starter Template for React, TypeScript, postCSS, ITCSS, CSS-Modules, Webpack and Live Reloading (React Hot Loader 3)","archived":false,"fork":false,"pushed_at":"2023-01-07T02:17:20.000Z","size":13932,"stargazers_count":118,"open_issues_count":38,"forks_count":33,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-19T21:10:09.674Z","etag":null,"topics":["css-modules","postcss","react","stylelint","tslint","typescript","webpack2"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jquintozamora.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-02T18:25:20.000Z","updated_at":"2024-05-29T15:34:45.000Z","dependencies_parsed_at":"2023-02-06T10:31:35.203Z","dependency_job_id":null,"html_url":"https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquintozamora%2Freact-typescript-webpack2-cssModules-postCSS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquintozamora%2Freact-typescript-webpack2-cssModules-postCSS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquintozamora%2Freact-typescript-webpack2-cssModules-postCSS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquintozamora%2Freact-typescript-webpack2-cssModules-postCSS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jquintozamora","download_url":"https://codeload.github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230501172,"owners_count":18236061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css-modules","postcss","react","stylelint","tslint","typescript","webpack2"],"created_at":"2024-09-24T13:53:46.496Z","updated_at":"2026-03-06T13:04:45.424Z","avatar_url":"https://github.com/jquintozamora.png","language":"TypeScript","readme":"[![Build Status](https://travis-ci.org/jquintozamora/react-typescript-webpack2-cssModules-postCSS.svg?branch=master)](https://travis-ci.org/jquintozamora/react-typescript-webpack2-cssModules-postCSS)\n [![Dependabot Status](https://api.dependabot.com/badges/status?host=github\u0026repo=jquintozamora/react-typescript-webpack2-cssModules-postCSS\u0026identifier=80755170)](https://dependabot.com)\n [![codecov](https://codecov.io/gh/jquintozamora/react-typescript-webpack2-cssModules-postCSS/branch/master/graph/badge.svg)](https://codecov.io/gh/jquintozamora/react-typescript-webpack2-cssModules-postCSS)\n\n# Simple Starter Template for React, TypeScript, postCSS, ITCSS, CSS-Modules, Webpack 2 and Live Reloading (React Hot Loader 3)\n\nUse this Starter template to create quickly first scaffolding for your SPA project.\nIf you like to don't forget to ★ on Github.\n\n\n## Features\n- [React](https://facebook.github.io/react)\n- [TypeScript](https://www.typescriptlang.org) (compiling directly to ES5)\n  - Using [@types instead of TSD or typings folder](https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/blob/master/tsconfig.json#L43)\n- [Hot Module Replacement](https://medium.com/@dan_abramov/hot-reloading-in-react-1140438583bf#.xh6v0ht7j) ([React Hot Loader](https://github.com/gaearon/react-hot-loader/issues/243))\n- [Webpack](https://webpack.js.org)\n    - [Webpack-dev-server](https://webpack.js.org/configuration/dev-server/)\n    - [Webpack configuration for HMR](https://webpack.js.org/concepts/hot-module-replacement/)\n    - Webpack production configuration\n         - Split out css files using [ExtractTextPlugin](https://webpack.js.org/plugins/extract-text-webpack-plugin)\n         - [UglifyJsPlugin with options](https://github.com/webpack/webpack/blob/v2.4.1/lib/optimize/UglifyJsPlugin.js)\n         - Use include in the loader instead of the exclude. [More info](http://stackoverflow.com/questions/37823764/how-include-and-exclude-works-in-webpack-loader)\n         - More perfomance tips: [here](https://medium.com/@khanght/optimize-webpack-production-build-ec594242b222#.bj3eyg65p)\n    - [Webpack stats](https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/blob/master/webpack/webpack.config.stats.js) (bundle optimization helper)\n        - Generate stats.json file with profiler. Use (this tool)[http://webpack.github.io/analyse/] to analyze it.\n        - [webpack visualizer](https://chrisbateman.github.io/webpack-visualizer/)\n- [EditorConfig](http://editorconfig.org/)\n- Styling\n  - General Styling (app/stylesheets):\n      - To include variables, generic CSS, normalize, reset, type selectors, ...\n      - Methodology: [ITCSS](http://itcss.io)\n      - Tools: [postCSS](http://postcss.org) with [import](https://github.com/postcss/postcss-import), [nesting](https://www.npmjs.com/package/postcss-nesting), [custom properties](https://github.com/postcss/postcss-custom-properties) and [autoprefixer](https://github.com/postcss/autoprefixer).\n  - Components Styling (app/src/components/...):\n      - To be the module's CSS\n      - Techniques: [CSS Modules](https://github.com/css-modules/css-modules) + [postCSS](http://postcss.org) ([import](https://github.com/postcss/postcss-import), [nesting](https://www.npmjs.com/package/postcss-nesting), [custom properties](https://github.com/postcss/postcss-custom-properties) and [autoprefixer](https://github.com/postcss/autoprefixer)).\n- Linting\n  - TypeScript:\n    - [TSLint](https://palantir.github.io/tslint): general rules + [react rules](https://github.com/palantir/tslint-react)\n    - [VS Code TSLint extension](https://marketplace.visualstudio.com/items?itemName=eg2.tslint)\n  - Styles\n    - [Stylint](https://stylelint.io): CSS rules\n      - Rules are on .stylelintrc.json\n      - [All the rules](https://stylelint.io/user-guide/rules)\n    - Install VS Code extensions:\n        - [stylelint](https://marketplace.visualstudio.com/items?itemName=shinnn.stylelint)\n        - [stylefmt](https://marketplace.visualstudio.com/items?itemName=mrmlnc.vscode-stylefmt)\n          - Shift + Alt + F (Format Code)\n          - Be sure you have these configurations on your .vscode/settings.json:\n              - \"css.validate\": false,\n              - \"stylelint.enable\": true\n- Testing\n  - [Jest](https://facebook.github.io/jest/): testing framework\n  - Enzyme: helper for testing react components\n    - enzime-to-json: display snapshots correctly with jest and enzyme\n  - identity-obj-proxy: mock css files when testing\n  - react-test-renderer: tbc\n  - ts-jest: needed to make work jest with TypeScript\n\n\n\n\n## Getting Started\n### Install pre-requisites\n- Node.js and NPM: [Download and install](https://nodejs.org/). *I have version 7.9.0 of Node and 4.5.0 of NPM on Windows PC*\n- Git: [Download and install](https://git-scm.com/). *I have version 2.7.4 installed on Windows PC*\n\n### Clone Repo\n1. Get the url of your forked project.\n    - Go to https://github.com/username/react-typescript-webpack2-cssModules-postCSS\n2. Click on **\"Clone or download\"** and Copy to clipboard the url ending on .git.\n3. Open your command line and go to your directoy\n*You don't need to create a specific folder for the project, it will be created by git*\n4. Clone your forked repo on your machine:\n```\n$ git clone https://github.com/username/react-typescript-webpack2-cssModules-postCSS\n```\n*Note: That will create a new folder called react-typescript-webpack2-cssModules-postCSS with all the files in.*\n\n\n### Install Project dependencies\n```\n$ cd react-typescript-webpack2-cssModules-postCSS\n$ npm install\n```\n\n\n### Open the project with your Development IDE\nI use VS Code https://code.visualstudio.com\nOpen the project using this command:\n```\n$ code .\n```\n\n### Start development server with Hot Reloading\n```\n$ npm run start\n```\n\n### Build for production\n```\n$ npm run build\n```\n\n### Generate Stats (it stores the html file with the stats under webpack/stats folder)\n```\n$ npm run stats\n```\nYou will see the stats:\n\u003cbr /\u003e\n\u003cimg src=\"./assets/webpackvisualizer.png\" width=\"400\"\u003e\n\n### Enjoy!\n\n## Useful demo\nAs part of the boilerplate, you will see a fancy demo app with two react components already created:\n- Viewer\n  - [Stateless component](https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/blob/master/app/src/components/Viewer/Viewer.tsx) (no state)\n  - Use [CSS-Modules](https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/blob/master/app/src/components/Viewer/Viewer.module.css)\n- ViewerItem\n  - Create [3 types of Item Card object](https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/blob/master/app/src/components/ViewerItem/ViewerItemCardType.ts) (singleton, factory static)\n  - Use [inline css using a function to assign CSS depending on the object](https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/blob/master/app/src/components/ViewerItem/ViewerItem.inlined.css.ts)\n  - Render [Table layout compatible with emails](https://github.com/jquintozamora/react-typescript-webpack2-cssModules-postCSS/blob/master/app/src/components/ViewerItem/ViewerItem.tsx)\n\n![demoapp](./assets/demoapp.png)\n\n\n## License\nBSD 3-Clause License\n\nCopyright (c) 2019, [José Quinto](https://blog.josequinto.com)\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquintozamora%2Freact-typescript-webpack2-cssmodules-postcss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjquintozamora%2Freact-typescript-webpack2-cssmodules-postcss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquintozamora%2Freact-typescript-webpack2-cssmodules-postcss/lists"}