Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use package files instead of `.npmignore #49

Closed

Conversation

estevanmaito
Copy link
Contributor

The npm package currently weights 18.9MB with 62 files in total. This is (mostly) due to the Next demo being published (it was part of .gitignore but not of .npmignore).

This PR reduces the package size to 39.4 kB and 4 files by selecting specific files of the final package instead of removing unwanted ones.

*Note 1: I left out scripts and CSS from dist as it isn't being used in the current form of the plugin.

*Note 2: that the following comparison shows significant smaller bundle (before) because I didn't build the demo.

Before:

> @tailwindcss/[email protected] prepare .
> node scripts/build.js

Building CSS...
Finished building CSS.

package: @tailwindcss/[email protected]    
=== Tarball Contents === 
104.5kB dist/typography.css
78.0kB  dist/typography.min.css
15.1kB  demo/public/favicon.ico
255B    demo/pages/_app.js
936B    scripts/build.js
6.5kB   demo/pages/index.js
1.5kB   src/index.js
115B    demo/next.config.js
131B    demo/postcss.config.js
27.9kB  src/styles.js
927B    demo/tailwind.config.js
999B    package.json
9.0kB   README.md
10.8kB  demo/components/MarkdownSample.mdx
1.0kB   demo/public/favicon-16x16.png
1.3kB   demo/public/favicon-32x32.png
3.8kB   .github/logo.svg
=== Tarball Details ===
name:          @tailwindcss/typography
version:       0.2.0
package size:  36.5 kB
unpacked size: 262.8 kB
shasum:        fdbef09f0487e2c971accf02ad37d144dc82f762
integrity:     sha512-mt0Uucoj+J+i6[...]ZNzw63A/1nKOw==
total files:   17

+ @tailwindcss/[email protected]

After:

> @tailwindcss/[email protected] prepare .
> node scripts/build.js

Building CSS...
Finished building CSS.
npm notice
package: @tailwindcss/[email protected]
=== Tarball Contents ===
1.5kB  src/index.js
27.9kB src/styles.js
1.0kB  package.json
9.0kB  README.md
=== Tarball Details ===
name:          @tailwindcss/typography
version:       0.2.0
package size:  6.8 kB
unpacked size: 39.4 kB
shasum:        b4170d7d246b5ecde7c77a5f20d780eab0645d85
integrity:     sha512-h/LM47GDxQsyA[...]jeBAaGL5RLbYQ==
total files:   4

+ @tailwindcss/[email protected]

Resulting data provided by npm publish --dry-run

@RobinMalfait
Copy link
Member

Hey! Thank you for your PR!
Much appreciated! 🙏

I created a new PR that was rebased on master and also added the dist folder for cdn reasons.
I cherry picked your commit to keep you as a maintainer, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants