Giter VIP home page Giter VIP logo

vite-config's Introduction

Vite Config Template

License: MIT Github Actions made-for-VSCode GitHub tag

This template is a compilation of settings for a Vite Javascript project. It focuses on keeping production code as close to the original code as possible. Currently a work in progress though useful as a reference!

Tools Configured Notes
ESLint ✔️ Uses .browserslistrc file and engines.node entry in package.json for browser + node compatibility. AirBnB styleguide.
Stylelint ✔️ Browser compatibility is enforced using .browserslistrc. Custom style rules defined in .stylelintrc.json
Jest ✔️ Additional ES linting configured for Jest specifics
Playwright ✔️ Similar to puppeteer. Additional ES linting configured for Playwright specifics
Github Actions ✔️ SCSS + JS linting and Jest unit + playwright tests. Configured to run on pull requests and pushes to master
SCSS ✔️ SASS should work as well
Yarn 2 ✔️ Plug n Play (PnP) is disabled in favor of node_modules for compatibility
VSCode ✔️ Some config settings for Stylelint
Git Hooks ✔️ ESLint & Stylelint configured to run on pre-commit
Prettier Code styling is enforced through ESLint and Stylelint
Typescript Vanilla JS used
Babel ESLint & Stylelint are configured to enforce compatibility over using Babel to transpile code
Codecov Planning on adding code coverage in the future

Notable Files

These files contain documentaton that is helpful for referencing purposes.

File Notes
index-ref.html Useful info like favicon tags and meta tags
manifest.json Main attributes and what they're for
robots.txt Some notes on robots.txt
sitemap_index.xml How to use a sitemap_index and why use one
sitemap.xml Sitemap schema and attributes
reset.scss A file containing some browser CSS resets to disable unwanted behavior

Node & Browser Compatibility

The project is configured to enforce JS compatibility using both .browserslistrc and the engines.node entry in package.json. SCSS browser compatibility is also enforced using the .browserslistrc file.

  • eslint-plugin-compat enforces browser compatibility. To remove it, uninstall the package and remove "plugin:compat/recommended" from your .eslintrc.json file under extends: as well as the compat item in the plugins: array.

  • eslint-plugin-node enforces node compatibility using the engines.node entry in package.json. To remove it, uninstall the package and remove "plugin:node/recommended" from your .eslintrc.json file under extends: as well as the node item in the plugins: array.

  • stylelint-no-unsupported-browser-features enforces browser compatibility for SCSS. To remove it, uninstall the package and remove stylelint-no-unsupported-browser-features from the plugins: array in the .stylelintrc.json file.

Vite

Vite is configured to:

  • Compress assets using Brotli. GZip is another option.
  • Optimize SVGs and images
  • Minify for production
  • Combine duplicate media queries, selectors and autoprefix styles based on the browser versions specified in .browserslistrc

Installation

Run the yarn install command to set up the node_modules folder. If you want to try out yarn plug n play, remove nodeLinker: node-modules from .yarnrc.yml before installing. Note the config isn't tested with that, so you'll likely need to adjust things to work.

License

This project is MIT licensed.

vite-config's People

Contributors

woodbrettm avatar

Stargazers

 avatar

Watchers

 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.