-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
- Loading branch information
Showing
28 changed files
with
12,999 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_size = 2 | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
dist | ||
.nuxt | ||
coverage | ||
*.log* | ||
.DS_Store | ||
.code | ||
*.iml | ||
package-lock.json | ||
templates/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
extends: ['@nuxtjs/eslint-config-typescript', 'prettier'], | ||
rules: { | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
curly: 'off', | ||
'no-empty': 'off', | ||
'no-undef': 'off', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
name: Bug report | ||
about: Report a bug report to help us improve the module. | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Version | ||
module: <!-- ex: 5.9.0 --> | ||
nuxt: <!-- ex: 2.0.0 --> | ||
|
||
### Nuxt configuration | ||
#### [mode](https://nuxtjs.org/api/configuration-mode): <!--universal is the default --> | ||
- [ ] universal | ||
- [ ] spa | ||
|
||
### Nuxt configuration | ||
<!-- | ||
If relevant, please include the configuration you are using for this module. | ||
For example: | ||
``` | ||
``` | ||
--> | ||
|
||
## Reproduction | ||
> :warning: without a minimal reproduction we wont be able to look into your issue | ||
**Link:** | ||
[ ] https:///codesandbox.io/ | ||
[ ] GitHub repository | ||
|
||
#### What is expected? | ||
#### What is actually happening? | ||
#### Steps to reproduce | ||
## Additional information | ||
## Checklist | ||
* [ ] I have tested with the latest Nuxt version and the issue still occurs | ||
* [ ] I have tested with the latest module version and the issue still occurs | ||
* [ ] I have searched the issue tracker and this issue hasn't been reported yet | ||
|
||
### Steps to reproduce | ||
|
||
|
||
### What is expected? | ||
|
||
|
||
### What is actually happening? | ||
<!-- Add any other context or screenshots about the feature request here. --> | ||
|
||
### Performance analysis? | ||
<!-- Add any performance metrics or regressions here --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Nuxt Community Discord | ||
url: https://discord.nuxtjs.org/ | ||
about: Consider asking questions about the module here. | ||
# - name: Documentation | ||
# url: /README.md | ||
# about: Check our documentation before reporting issues or questions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea or enhancement for this project. | ||
title: '' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Is your feature request related to a problem? Please describe. | ||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --> | ||
|
||
### Describe the solution you'd like to see | ||
<!-- A clear and concise description of what you want to happen. --> | ||
|
||
### Describe alternatives you've considered | ||
<!-- A clear and concise description of any alternative solutions or features you've considered. --> | ||
|
||
### Additional context | ||
<!-- Add any other context or screenshots about the feature request here. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Question | ||
about: Ask a question about the module. | ||
title: '' | ||
labels: question | ||
assignees: '' | ||
|
||
--- | ||
|
||
<!-- | ||
**IMPORTANT!** | ||
Please make sure to look for an answer to your question in our documentation before asking a question here. | ||
If you have a general question regarding {{ name }} use Discord `modules` channel. Thanks! | ||
Documentation: {{ docs }} | ||
Nuxt Discord: https://discord.nuxtjs.org/ | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
node: [12, 14] | ||
|
||
steps: | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: node_modules | ||
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
|
||
- name: Lint | ||
run: yarn lint:all | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
- name: Coverage | ||
uses: codecov/codecov-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node_modules | ||
*.iml | ||
.idea | ||
*.log* | ||
.nuxt | ||
.vscode | ||
.DS_Store | ||
coverage | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"git": { | ||
"commitMessage": "chore: release v${version}" | ||
}, | ||
"github": { | ||
"release": true, | ||
"releaseName": "v${version}" | ||
}, | ||
"npm": { | ||
"skipChecks": true | ||
}, | ||
"plugins": { | ||
"@release-it/conventional-changelog": { | ||
"preset": "conventionalcommits", | ||
"infile": "CHANGELOG.md" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# @nuxtjs/critters | ||
|
||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href] | ||
[![Codecov][codecov-src]][codecov-href] | ||
[![License][license-src]][license-href] | ||
|
||
> CSS optimization using [critters](https://github.com/GoogleChromeLabs/critters) for [Nuxt](https://nuxtjs.org) | ||
## Features | ||
|
||
- Zero-configuration required | ||
- Enables CSS Extraction | ||
- Critical CSS automatically injected to page | ||
|
||
## Quick setup | ||
|
||
1. Add `@nuxtjs/critters` dependency to your project | ||
|
||
```bash | ||
yarn add @nuxtjs/critters # or npm install @nuxtjs/critters | ||
``` | ||
|
||
2. Add `@nuxtjs/critters` to the `modules` section of `nuxt.config.js` | ||
|
||
```js | ||
{ | ||
modules: [ | ||
'@nuxtjs/critters', | ||
], | ||
} | ||
``` | ||
|
||
## How it works | ||
|
||
Nuxt has a number of ways to optimize your CSS in production: | ||
|
||
1. ✅ Nuxt uses [`cssnano`](https://cssnano.co/) at the build step to minify CSS rules | ||
2. 📦 You can enable [`purgecss`](https://github.com/Developmint/nuxt-purgecss) to remove unused CSS rules from your bundle. | ||
3. ✅ with `@nuxtjs/critters` you can now extract CSS files and load them separately, just inlining the CSS necessary to render the page. | ||
|
||
## Development | ||
|
||
1. Clone this repository | ||
2. Install dependencies using `yarn install` | ||
3. Start development server using `yarn dev` | ||
|
||
## License | ||
|
||
[MIT License](./LICENSE) | ||
|
||
<!-- Badges --> | ||
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/critters/latest.svg | ||
[npm-version-href]: https://npmjs.com/package/@nuxtjs/critters | ||
|
||
[npm-downloads-src]: https://img.shields.io/npm/dm/@nuxtjs/critters.svg | ||
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/critters | ||
|
||
[github-actions-ci-src]: https://github.com/nuxt-community/critters-module/workflows/ci/badge.svg | ||
[github-actions-ci-href]: https://github.com/nuxt-community/critters-module/actions?query=workflow%3Aci | ||
|
||
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/critters-module.svg | ||
[codecov-href]: https://codecov.io/gh/nuxt-community/critters-module | ||
|
||
[license-src]: https://img.shields.io/npm/l/@nuxtjs/critters.svg | ||
[license-href]: https://npmjs.com/package/@nuxtjs/critters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
modules: ['../src/index.ts'], | ||
css: ['~/styles/global.css'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<div :class="toggle ? 'sample-class' : 'sample-unused-class'"> | ||
some text | ||
<button @click="toggle = !toggle">Toggle class</button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data: () => ({ | ||
toggle: true | ||
}), | ||
} | ||
</script> | ||
|
||
<style> | ||
.sample-class { | ||
background: blue; | ||
} | ||
.sample-unused-class { | ||
background: red; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: darkgoldenrod; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "../tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
preset: '@nuxt/test-utils', | ||
collectCoverage: true, | ||
collectCoverageFrom: ['src/**'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'*.{js,ts,vue}': ['yarn lint'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Global settings applied to the whole site. | ||
# | ||
# “base” is the directory to change to before starting build. If you set base: | ||
# that is where we will look for package.json/.nvmrc/etc, not repo root! | ||
# “command” is your build command. | ||
# “publish” is the directory to publish (relative to the root of your repo). | ||
|
||
[build] | ||
base = "docs" | ||
command = "yarn && yarn generate" | ||
publish = "dist" |
Oops, something went wrong.