xatriumcss 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/bin/xatriumcss +2 -0
- package/index.js +315 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +44 -0
- package/src/cli.js +184 -0
- package/src/collectClasses.js +477 -0
- package/src/index.js +26 -0
- package/src/parser.js +26836 -0
- package/src/postcss.js +22 -0
- package/src/vite.js +40 -0
- package/xatriumcss.win32-x64-msvc.node +0 -0
package/src/postcss.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { runParser } = require('./parser');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
module.exports = (opts = {}) => {
|
|
5
|
+
return {
|
|
6
|
+
postcssPlugin: 'xatriumcss',
|
|
7
|
+
Once(root, { result }) {
|
|
8
|
+
const inputFile = result.opts.from || './src/input.css';
|
|
9
|
+
const outputFile = result.opts.to || './dist/output.css';
|
|
10
|
+
|
|
11
|
+
const config = {
|
|
12
|
+
input: inputFile,
|
|
13
|
+
output: outputFile,
|
|
14
|
+
content: opts.content || ['./src/**/*.{html,js,jsx,ts,tsx,vue}']
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
runParser(config);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
module.exports.postcss = true;
|
package/src/vite.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const { runParser, hasXatriumImport } = require('./parser');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function xatriumcss(options = {}) {
|
|
5
|
+
let config;
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
name: 'vite-plugin-xatriumcss',
|
|
9
|
+
|
|
10
|
+
configResolved(resolvedConfig) {
|
|
11
|
+
config = resolvedConfig;
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
buildStart() {
|
|
15
|
+
const inputFile = options.input || './src/input.css';
|
|
16
|
+
const outputFile = options.output || './dist/output.css';
|
|
17
|
+
|
|
18
|
+
if (hasXatriumImport(inputFile)) {
|
|
19
|
+
runParser({
|
|
20
|
+
input: inputFile,
|
|
21
|
+
output: outputFile,
|
|
22
|
+
content: options.content || ['./src/**/*.{html,js,jsx,ts,tsx,vue}']
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
handleHotUpdate({ file }) {
|
|
28
|
+
if (file.match(/\.(html|jsx?|tsx?|vue)$/)) {
|
|
29
|
+
// Trigger rebuild on file change
|
|
30
|
+
runParser({
|
|
31
|
+
input: options.input || './src/input.css',
|
|
32
|
+
output: options.output || './dist/output.css',
|
|
33
|
+
content: options.content || ['./src/**/*.{html,js,jsx,ts,tsx,vue}']
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = xatriumcss;
|
|
Binary file
|