-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baba633
commit 008adbb
Showing
17 changed files
with
354 additions
and
95 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
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 @@ | ||
node_modules | ||
dist | ||
|
||
# You probably will want to remove these entries | ||
.bud |
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 @@ | ||
module.exports = app => | ||
app | ||
.template({template: 'public/index.html'}) | ||
.entry({app: 'app.css'}) | ||
.purgecss({ | ||
content: [app.path('project', 'public', '*.html')], | ||
css: [app.path('src', '**', '*.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,5 @@ | ||
{ | ||
"typeAcquisition": { | ||
"enable": true | ||
} | ||
} |
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,26 @@ | ||
{ | ||
"name": "example-purgecss", | ||
"private": true, | ||
"browserslist": { | ||
"production": [ | ||
">0.5%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@fullhuman/postcss-purgecss": "4.1.3", | ||
"@roots/bud": "workspace:*", | ||
"@roots/bud-postcss": "workspace:*", | ||
"@roots/bud-purgecss": "workspace:*", | ||
"postcss": "8.4.5", | ||
"postcss-import": "14.0.2", | ||
"postcss-nested": "5.0.6", | ||
"postcss-preset-env": "7.1.0" | ||
} | ||
} |
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,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1" | ||
/> | ||
|
||
<title>%APP_TITLE%</title> | ||
<meta name="theme-color" content="%APP_COLOR%" /> | ||
<meta name="description" content="%APP_DESCRIPTION%" /> | ||
</head> | ||
|
||
<body> | ||
<h1>PostCSS</h1> | ||
<h2>PurgeCss test</h2> | ||
</body> | ||
</html> |
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 @@ | ||
@import 'main'; |
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 @@ | ||
h1 { | ||
color: black; | ||
} | ||
|
||
h2 { | ||
color: red; | ||
} | ||
|
||
h3.exclude { | ||
color: yellow; | ||
} |
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
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 @@ | ||
import {Extension} from '@roots/bud-framework' | ||
|
||
import * as purge from './purge.interface' | ||
|
||
declare module '@roots/bud-framework' { | ||
interface Framework { | ||
purgecss: purge.api | ||
} | ||
|
||
interface Modules { | ||
'@roots/bud-purgecss': Extension.Module | ||
} | ||
} |
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
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
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,87 @@ | ||
import {Extension, Framework} from '@roots/bud-framework' | ||
|
||
/** | ||
* Module registration | ||
* | ||
* @public | ||
*/ | ||
export interface register { | ||
(app: Framework): Promise<void> | ||
} | ||
|
||
/** | ||
* Purge unused CSS from compiled stylesheets | ||
* | ||
* @remarks | ||
* For more information, see [the PurgeCSS API](https://purgecss.com/configuration.html) | ||
* | ||
* @example | ||
* ```js | ||
* app.purgecss({ | ||
* content: [app.path('project', 'resources/views/**')], | ||
* allow: require('purgecss-with-wordpress').whitelist, | ||
* allowPatterns: require('purgecss-with-wordpress').whitelistPatterns, | ||
* }) | ||
* ``` | ||
*/ | ||
export interface api { | ||
(this: Framework, userOptions: UserOptions): Framework | ||
} | ||
|
||
export interface Purge extends Extension.Module { | ||
name: string | ||
register: register | ||
api: {purgecss: api} | ||
} | ||
|
||
/** | ||
* PurgeCSS UserOptions | ||
* | ||
* @see https://purgecss.com/plugins/postcss.html#options | ||
* | ||
* @public | ||
*/ | ||
export interface UserOptions { | ||
content?: Array< | ||
| string | ||
| { | ||
extension: string | ||
raw: string | ||
} | ||
> | ||
contentFunction?: (sourceFile: string) => Array< | ||
| string | ||
| { | ||
extension: string | ||
raw: string | ||
} | ||
> | ||
defaultExtractor?: ExtractorFunction | ||
extractors?: Array<Extractors> | ||
fontFace?: boolean | ||
keyframes?: boolean | ||
output?: string | ||
rejected?: boolean | ||
stdin?: boolean | ||
stdout?: boolean | ||
variables?: boolean | ||
safelist?: | ||
| { | ||
standard?: Array<RegExp | string> | ||
deep?: RegExp[] | ||
greedy?: RegExp[] | ||
variables?: Array<RegExp | string> | ||
keyframes?: Array<RegExp | string> | ||
} | ||
| Array<RegExp | string> | ||
blocklist?: Array<RegExp | string> | ||
} | ||
|
||
export type ExtractorFunction<T = string> = ( | ||
content: T, | ||
) => string[] | ||
|
||
export interface Extractors { | ||
extensions: string[] | ||
extractor: ExtractorFunction | ||
} |
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
Oops, something went wrong.