/** resolve.exports but for imports */ | |
/** | |
* @param {object} imports | |
* @param {Set<string>} keys | |
*/ | |
function loop(imports, keys) { | |
if (typeof imports === 'string') { | |
return imports; | |
} |
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'
instead ofconst foo = require('foo')
to import the package. You also need to put"type": "module"
in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)
from CommonJS instead ofrequire(…)
. - Stay on the existing version of the package until you can move to ESM.
-
When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!
-
Always use fewer utility classes when possible. For example, use
mx-2
instead ofml-2 mr-2
and don't be afraid to use the simplerp-4 lg:pt-8
instead of the longer, more complicatedpt-4 lg:pt-8 pr-4 pb-4 pl-4
. -
Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use
block lg:flex lg:flex-col lg:justify-center
instead ofblock lg:flex flex-col justify-center
to make it very clear that the flexbox utilities are only applicable at the
import * as path from 'path' | |
import ts from 'typescript' | |
function build( | |
override: { | |
compilerOptions?: ts.CompilerOptions | |
include?: string[] | |
exclude?: string[] | |
files?: string[] | |
extends?: string |
git log -n 10\ | |
--pretty=format:'{"commit": "%H", "author": "%aN <%aE>", "date": "%ai", "message": """%B""", "notes": """%N""" },' \ | |
$@ | awk 'BEGIN { print("[") } { print($0) } END { print("]") }' | python -u -c \ | |
'import ast,json,sys; print(json.dumps(ast.literal_eval(sys.stdin.read())))' |
- The app that uses tailwind + external component library (CL) (but not 3rdparty, your company internal one, for example)
- The component library also uses tailwind
To be able to purge safely unused tailwind classes from the build (https://tailwindcss.com/docs/controlling-file-size)
The idea here is simple: we're going to purge css on the app side + whitelist classes that component library is using.
permalink https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/bootstrap/index.js
- open and validate gatsby-config (get-config-file.js) 1.5 load themes (swyx added this note July 2019)
- load plugins (load-plugins/index.js) from the list given in
gatsby-config.js
- onPreBootstrap: runs
onPreBootstrap
if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c9