-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
15 changed files
with
336 additions
and
3 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
/node_modules/ | ||
node_modules/ | ||
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 @@ | ||
/test/**/* |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"test": "rimraf dist/ && rollup -c --silent && node src/check.js && rimraf dist/" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^6.1.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.33.3", | ||
"tslib": "^2.0.3", | ||
"typescript": "^4.1.2" | ||
} | ||
} |
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 @@ | ||
export const _parent = 'parent' |
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,16 @@ | ||
import typescript from '@rollup/plugin-typescript' | ||
import purgecssKeepStringLiterals from '..' | ||
|
||
export default { | ||
input: 'src/index.ts', | ||
output: { file: 'dist/index.js' }, | ||
plugins: [ | ||
typescript({ noEmit: true }), | ||
purgecssKeepStringLiterals({ | ||
css: ['src/source.css'], | ||
output: 'dist/utilities.css', | ||
include: ['src/**/*.ts'], | ||
exclude: ['**/excluded/**'], | ||
}), | ||
], | ||
} |
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,15 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const read = filename => fs.readFileSync(path.resolve(__dirname, filename), 'utf8').replace(/\s+/g, '') | ||
|
||
const actual = read('../dist/utilities.css') | ||
const expected = read('expected.css') | ||
if (actual === expected) { | ||
console.log('test success') | ||
} else { | ||
console.error('test failure') | ||
console.log('expected: ', expected) | ||
console.log(' actual: ', actual) | ||
process.exit(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 @@ | ||
export const _excluded = 'excluded' |
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 @@ | ||
.a{} | ||
.b{} | ||
.c{} | ||
.included{} | ||
.hover\:hoverable:hover{} |
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 @@ | ||
export const _included = 'included' |
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,17 @@ | ||
import { _parent } from '../parent' | ||
import { _included } from './included' | ||
import { _excluded } from './excluded' | ||
|
||
console.log(_parent, _included, _excluded) | ||
|
||
const x = 'a' | ||
|
||
const y = function (s: string) { | ||
if (arguments.length === 0) { | ||
return "b" | ||
} else { | ||
return `c ${s}` | ||
} | ||
} | ||
|
||
const z = 'hover:hoverable' |
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 @@ | ||
.a{} | ||
.b{} | ||
.c{} | ||
.d{} | ||
.e{} | ||
.f{} | ||
.g{} | ||
.h{} | ||
.i{} | ||
.j{} | ||
.k{} | ||
.l{} | ||
.m{} | ||
.n{} | ||
.o{} | ||
.p{} | ||
.q{} | ||
.r{} | ||
.s{} | ||
.t{} | ||
.u{} | ||
.v{} | ||
.w{} | ||
.x{} | ||
.y{} | ||
.z{} | ||
|
||
.parent{} | ||
._parent{} | ||
.included{} | ||
._included{} | ||
.excluded{} | ||
._excluded{} | ||
|
||
.export{} | ||
.const{} | ||
.function{} | ||
.if{} | ||
.else{} | ||
.return{} | ||
.arguments{} | ||
.length{} | ||
.string{} | ||
|
||
.hover\:hoverable:hover{} |