svgr
esbuild
Our great sponsors
svgr | esbuild | |
---|---|---|
26 | 276 | |
9,309 | 34,430 | |
- | - | |
8.3 | 9.9 | |
22 days ago | 5 days ago | |
TypeScript | Go | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
svgr
-
One way of building an SVG icon library for your project
Really interesting framework agnostic approach, but I think SVGR is a better option for my React homies. It imports an SVG file as a React component. Shouts also to react-icons if Font Awesome, Material Icons and friends are more your bag.
-
Alternative libs to migrate from React to Vue (or Vue to React)
SVGR
-
Power up SVGs with React and CSS
There is another way to import an SVG in Create React App, though. We can import the SVG as a ReactComponent. This is because CRA leverages SVGR to process SVGs.
-
Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ React-ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΡ ΠΈΠΊΠΎΠ½ΠΎΠΊ Ρ ΠΏΠΎΠΌΠΎΡΡΡ Figma API ΠΈ SVGR. Π§Π°ΡΡΡ 2.
const { types } = require('@babel/core'); module.exports = { ... template: function svgrCustomTemplate( { imports, interfaces, componentName, props, jsx, exports }, { tpl } ) { // ΠΌΠ΅Π½ΡΠ΅ΠΌ ΠΊΠΎΡΠ½Π΅Π²ΠΎΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ Π½Π° SvgIcon jsx.openingElement.name.name = 'SvgIcon'; jsx.closingElement.name.name = 'SvgIcon'; // https://github.com/gregberge/svgr/issues/530 // ΠΏΡΠΈ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΈ ΠΊΠΎΡΠ½Π΅Π²ΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° ΠΏΡΠΎΠΏΠ°Π΄Π°Π΅Ρ ΡΠΏΡΠ΅Π΄ ΠΏΡΠΎΠΏΡΠΎΠ² // ΠΏΠΎΡΡΠΎΠΌΡ Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌΠΎ Π΄ΠΎΠ±Π°Π²ΠΈΡΡ ΡΠΏΡΠ΅Π΄ ΠΏΡΠΎΠΏΡΠΎΠ² ΡΠ°ΠΌΠΎΡΡΠΎΡΡΠ΅Π»ΡΠ½ΠΎ jsx.openingElement.attributes.push( types.jSXSpreadAttribute(types.identifier('props')) ); return tpl` ${imports}; import { SvgIcon } from '../SvgIcon'; ${interfaces}; const ${componentName} = (${props}) => ( ${jsx} ); ${exports}; ` } }
-
Using SVGs in Common Lisp web apps with Djula
To solve these problems and have a better development workflow, I have created a package called cl-djula-svg which automates all the above steps for you. The inspiration for this package came from svgr which exactly does the same thing in React applications. It takes a SVG file, process some override logic, optimize it and create React wrapper components based on the SVG content.
-
Some svg icons wont show with react native svg
I normally use SVGR but every time a designer sends me an svg iβll pass it in svgOmg that deletes all the unnecessary attributes and propietary code from figma, illustrator &co.
- External SVGs that you can style
-
How to debug from this error statement
https://github.com/gregberge/svgr/issues/362 this may help as well.
-
Repeating variable names for imports, types and switch. Got to be a better way!
If you're using Webpack, CRA, or Next.js, you should be using SVGR.
-
How to use SVGs in React
SVGR is the library that powers this ability. Setting it up could be a little hairy, thankfully many popular frameworks (Create React App, Gatsby) support this feature out of the box.
esbuild
-
Things I want to see in JavaScript and Front end development in 2023
esbuild https://esbuild.github.io/ I usually write my bundling progmatically with it now.
-
Inline scoped css files to reduce initial download
esbuild for using & bundling npm packages
-
An efficient way to build your serverless microservices. Part 1. Local Development.
integration with state-of-the-art JavaScript bundler - esbuild
-
The Role of Transpilers in Web Development
The so-called 'next generation compilers' have been gaining more and more momentum recently. The revolution started with the Go language powering ESBuild and now it's mainly focused on Rust and tools like SWC. What's the point?β - one may ask. Well, back in the past, JavaScript was used to build small or medium-sized web pages. However, this changed years ago and there are huge applications composed of hundreds of views and thousands of files available on the market.
- esbuild v0.17.0 - a major new release (with some backwards-incompatible changes)
-
What is(are) the best resource(s) to lean how to build modern web applications?
Packaging - turning all your code, CSS, assets, etc. into the files you'll actually stick on your host server. e.g. webpack, maybe esbuild, etc..
-
You Want Modules, Not Microservices
Where do you begin if the code was in hundreds of separate modules? It's not clear if it's easier. You would take time to load the code into your brain regardless of the structure.
By the way, JavaScript parser in esbuild is a 16 thousand lines of code module too:
https://github.com/evanw/esbuild/blob/0db0b46399de81fb29f6fc...
-
Maximizing Your Angular Build Performance with ESBUILD
ESBuild is a swift JavaScript compiler used for ViteJS. You can play with him in Angular, changing a single line in the angular.json file.
-
Accelerate your delivery with modern tools
One of the advantages Vite provides is how incredibly fast it is at building. Vite uses rollup for bundling and esbuild for transforming. Esbuild is written in Go and is 10-100x faster than the JavaScript-based alternatives.
-
Setting up a custom toolchain
A bundler lets you write modular code and bundle it together into small packages to optimize load time. Popular bundlers: webpack, Parcel, esbuild, swc.
What are some alternatives?
swc - Rust-based platform for the Web
vite - Next generation frontend tooling. It's fast!
Rollup - Next-generation ES module bundler
webpack - A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.
parcel - The zero configuration build tool for the web. π¦π
terser - π JavaScript parser, mangler and compressor toolkit for ES6+
Tailwind CSS - A utility-first CSS framework for rapid UI development.
import-maps - How to control the behavior of JavaScript imports
ts-node - TypeScript execution and REPL for node.js
tsup - The simplest and fastest way to bundle your TypeScript libraries.
PostCSS - Transforming styles with JS plugins
svg-sprite-loader - Webpack loader for creating SVG sprites.