GoogleChromeLabs / tooling.report

tooling.report a quick way to determine the best build tool for your next web project, or if tooling migration is worth it, or how to adopt a tool's best practice into your existing configuration and code base.
https://tooling.report
Apache License 2.0
847 stars 49 forks source link

What is tooling.report?

It's a quick way to determine the best build tool for your next web project, or if tooling migration is worth it, or how to adopt a tool's best practice into your existing configuration and code base.

To get set up

npm install

To dev

npm run dev

This starts the build in watch mode, and starts an HTTP server.

To build for production

npm run build

Project shape

Test structure

A test directory contains:

Special imports

Client bundles

import bundleURL, { imports } from 'client-bundle:client/home/index.ts';

client-bundle: followed by a path to script will bundle and minify that script as an entry point. If two entry points share a module, it'll be code-split.

This style of import can only be used in static-build.

CSS modules

import { $tabButton, $promo, $feature } from './styles.css';

Imports ending .css are assumed to be CSS modules. All exports are derived from classnames in the CSS. So, if the CSS contains .tab-button, then $tabButton will be one of the exports.

CSS bundles

import cssURL, { inline } from 'css-bundle:./styles.css';

The CSS supports CSS modules, Sass-style nesting, imports will be inlined, and the output will be minified.

Markdown

import { html, meta } from 'md:./whatever.md';

md: followed by a path to some markdown will give you the following:

Other assets

import assetURL from 'asset-url:./foo.png';

asset-url: followed by a path to a file will add that file to the build.

Constants

import isProduction from 'consts:isProduction';

If you want to add a constant value, add it to the object passed to constsPlugin in rollup.config.js. You'll also need to add an entry for it in missing-types.d.ts.

Test data

import tests from 'test-data:';

This returns an object representation of everything in the tests directory. See static-build/missing-types.d.ts for the structure of this object.