My personal project template using webpack and development packages that I use, along with the scripts I use on every project.
All the packages listed in package.json are already setup and configured with all-purpose settings. To see how things are configured specifically or to make changes check webpack.config.js and .eslintrc.json
- Webpack (module bundler)
- Normalize.css (CSS Reset)
- ESLint (linter)
- Setup with Airbnb style guide
- Prettier (code formatter)
- Includes eslint-config-prettier to solve conflicts between ESLint and Prettier
- Jest for TDD
- css-loader and style-loader to bundle
.cssfiles - html-webpack-plugin to bundle
.htmlfiles - Various development and hosting scripts
- Click the green "Use This Template" on this page -> "Create a new repository"
- Name the repository and clone it on your local machine
- Navigate to the repository's local folder and open in your preferred code editor
- Install all packages listed in
package.jsonwithnpm install - Program in the
./srcfolder, use included scripts to build your project, (output is in./dist)
- Build the project to
./distusing webpack withnpm run build - Build the project on save to
./distusing webpack withnpm run build-watch - Publish a dist folder github pages branch with
npm run github-pages-deploy - Lint
.jsfiles in the./srcfolder withnpm run lint
-
Prettier - Code FormatterVSCode Plugin -
ESLint VS Code PluginVSCode Plugin -
Add config below to your VSCode
settings.json(either for your workspace or user settings) to automatically lint with ESLint and format with Prettier on save.
"editor.formatOnSave": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"]