aliascss 1.1.10 → 1.1.12

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.
@@ -3,13 +3,13 @@ import { compilers } from './custom-compilers.js';
3
3
  const config={
4
4
  input:['demo/**/*.html'],
5
5
  output:{
6
- location:'demo/acss.css',
6
+ location:'demo/css/css/style/acss.css',
7
7
  "--file":true
8
8
  },
9
9
  '--module':true,
10
10
  prefix:'',
11
11
  importModuleAs:'x',
12
- // minify:true,
12
+ minify:true,
13
13
  extractorFunction:"x|@",
14
14
  //reg:new RegExp('x' + "(`|\\(["+`"'])`+ "(.+)" + "(`|" + `["']` + "\\))") ,
15
15
  media:{
@@ -50,6 +50,14 @@ const config={
50
50
  compiler:getCompiler('padding').compiler,
51
51
  values:[...getCompiler('padding').values,'var(--padding-xs,4px):xs','8px:sm','12px:md','14px:lg','16px:xl','20px:xxl']
52
52
  },
53
+ 'px':{
54
+ type:'group',
55
+ compiler:(value)=>{
56
+ // const value=
57
+
58
+ }
59
+ },
60
+ 'py':{},
53
61
  'shadows':{
54
62
  property:'box-shadow',
55
63
  //alias:'sdo',
@@ -80,15 +88,25 @@ const config={
80
88
  }
81
89
  },
82
90
  prebuild:{
83
- 'bg-dark':'background:#0f0f0f',
91
+ 'colorize-dark':'background:#0f0f0f;color:#e3e3e3',
92
+ 'colorize-light':'background:#e3e3e3;color:rgba(0,0,0,0.8)',
84
93
  'flex-center':'display:flex;align-items:center;justify-content:center',
85
94
  },
86
-
95
+ group:{
96
+ 'responsive':'xs-w-100p sm-w-540px md-w-720px lg-w-960px xl-w-1140px xxl-w-1320px',
97
+ 'responsive-sm':'xs-w-100p sm-w-540px md-w-720px lg-w-960px xl-w-1140px xxl-w-1320px',
98
+ 'responsive-md':'xs-w-100p sm-w-100p md-w-720px lg-w-960px xl-w-1140px xxl-w-1320px',
99
+ 'responsive-lg':'xs-w-100p sm-w-100p md-w-100p lg-w-960px xl-w-1140px xxl-w-1320px',
100
+ 'responsive-xl':'xs-w-100p sm-w-100p md-w-100p lg-w-100p xl-w-1140px xxl-w-1320px',
101
+ 'responsive-xll':'xs-w-100p sm-w-100p md-w-100p lg-w-100p xl-w-100p xxl-w-1320px',
102
+ 'responsive-fluid':'xs-w-100p sm-w-100p md-w-100p lg-w-100p xl-100p xxl-100p',
103
+ },
104
+ statement:`.color{color:red}`,
87
105
  ignore:['bgc-red']
88
106
  }
89
107
  export default config;
90
108
 
91
- const xconfig= {
109
+ /* const xconfig= {
92
110
  // input glob pattern or array of glob pattern
93
111
  input:'public/*.html',
94
112
 
@@ -172,6 +190,12 @@ const xconfig= {
172
190
  },
173
191
  // predefine className
174
192
  prebuild:{
193
+ //section
194
+ 'text-xl': 'font-size:20px;line-height:30px',
195
+ 'text-lg': 'font-size:18px;line-height:28px',
196
+ 'text-md': 'font-size:16px;line-height:24px',
197
+ 'text-sm': 'font-size:14px;line-height:20px',
198
+ 'text-xs': 'font-size:12px;line-height:18px',
175
199
 
176
200
  'text-xl': 'font-size:20px;line-height:30px',
177
201
  'text-lg': 'font-size:18px;line-height:28px',
@@ -201,9 +225,11 @@ const xconfig= {
201
225
  // pre group valid Aliascss classNames in single className
202
226
  group:{
203
227
  'container':' df fdc bsbb aic flex-shrink-1 flex-grow-1 ',
204
- 'section':'flex-shrink0 bsbb'
228
+ 'section':'flex-shrink0 bsbb',
229
+
205
230
  },
206
231
  // if some of the className collide with other CSS framework like bootstrap and tailwindcss
207
232
  // You wanna tell aliascss to ignore it...
208
233
  ignore:['fs12px', 'c-red','bgc-red'],// these classnames will be ignored
209
234
  }
235
+ */
package/bin/aliascss.js CHANGED
@@ -2,14 +2,14 @@
2
2
  import path from 'path';
3
3
  import fs from 'fs'
4
4
  import main,{watch} from "../lib/node/compileFile.js";
5
- import pkg from '../package.json' assert { type: "json" };
5
+ // import pkg from '../package.json' assert { type: "json" };
6
6
 
7
7
 
8
8
  const argSupplied=process.argv;
9
9
 
10
10
  //Version
11
11
  if(argSupplied.indexOf('--version')!=-1){
12
- console.log( 'version' ,pkg.version);
12
+ console.log( 'version' ,'@1.x.x');
13
13
  process.exit();
14
14
  }
15
15
  //Initialize args
@@ -37,17 +37,17 @@ if(isModule){
37
37
 
38
38
  if(isConfigFile && fs.existsSync(path.resolve(configFileName))){
39
39
  let configFile=await import(path.resolve(configFileName));
40
- //check if it has input and out file
40
+ // check if it has input and out file
41
+
42
+ // create output file if not exist
41
43
  if(configFile.default.hasOwnProperty('output') && configFile.default.output.location ){
44
+ const output=configFile.default.output.location;
45
+ if(!fs.existsSync(path.resolve(output))){
46
+ fs.mkdirSync(path.dirname(output),{recursive:true});
47
+ fs.closeSync(fs.openSync(output,'w'));
48
+ }
42
49
 
43
- // fs.closeSync(fs.openSync(configFile.default.output.location, 'w'));
44
-
45
- // if(!fs.existsSync(path.resolve(configFile.default.output.location))){
46
- // console.error('Please check if output property in aliascss.config.js has location to the output file');
47
- // process.exit();
48
- // }
49
-
50
- //check for input in config file
50
+ // check for input in config file
51
51
  if(!configFile.default.input){
52
52
  console.error('No Input to Process : Provide input (glob-pattern) in input property of aliascss.config.js');
53
53
  process.exit();
@@ -59,7 +59,7 @@ if(isConfigFile && fs.existsSync(path.resolve(configFileName))){
59
59
  }
60
60
 
61
61
  }else{
62
- console.error('Please check if there is output property in aliascss.config.js and it has valid path to the output file');
62
+ console.error('Please check input/output property in aliascss.config.js ');
63
63
  process.exit();
64
64
  }
65
65
 
@@ -70,6 +70,12 @@ if(isConfigFile && fs.existsSync(path.resolve(configFileName))){
70
70
  let input=argSupplied[2];
71
71
  // console.log(argSupplied[2]);
72
72
  let output=argSupplied[3];
73
+
74
+ if(!fs.existsSync(path.resolve(output))){
75
+ fs.mkdirSync(path.dirname(output),{recursive:true});
76
+ fs.openSync(output,'w');
77
+ }
78
+
73
79
  if(fs.existsSync(path.resolve(output)) && input){
74
80
 
75
81
  let config={
@@ -1,149 +1,47 @@
1
1
  import {getCompiler} from './lib/index.js'
2
2
  export const compilers={
3
- 'import-var':{
4
- type:'group',
5
- groups:{
6
- 'spacing':`
7
- --space-1:4px;
8
- --space-2:8px;
9
- --space-3:12px;
10
- --space-4:16px;
11
- --space-5:24px;
12
- --space-6:32px;
13
- --space-7:40px;
14
- --space-8:48px;
15
- --space-9:64px;
16
- `,
17
- theme:`
18
-
19
- `
20
- },
21
-
22
- },
23
- 'Text':{
24
-
25
- compiler:(value)=>{
26
- let result='';
27
- const match=/-([-]?[\w\.]+)/;
28
- const property=['font-size','line-height','letter-spacing','font-weight'];
29
- value.match(new RegExp(match,'g')).forEach((e,i)=>{
30
- if(i<property.length){
31
- result+=`${property[i]}:${e.replace(match,'$1').replace(/(\d)d(\d)/,'$1.$2').replace(/([\d])p([\s]|$)/,'$1%$2')};`;
32
- }
33
-
34
- })
35
- return result;
36
-
37
- },
38
- groups:{
39
- xs:'font-size:12px;line-height:18px;letter-spacing:0.0025em',
40
- '1':'font-size:12px;letter-spacing:0.0025em;line-height:16px;',
41
- '2':'font-size:14px;letter-spacing:0em;line-height:20px;',
42
- '3':'font-size:16px;letter-spacing:0em;line-height:24px;',
43
- '4':'font-size:18px;letter-spacing:-0.0025em;line-height:26px;',
44
- '5':'font-size:20px;letter-spacing:-0.005em;line-height:28px;',
45
- '6':'font-size:24px;letter-spacing:-0.00625em;line-height:30px;',
46
- '7':'font-size:28px;letter-spacing:-0.0075em;line-height:36px;',
47
- '8':'font-size:35px;letter-spacing:-0.01em;line-height:40px;',
48
- '9':'font-size:60px;letter-spacing:-0.025em;line-height:60px;',
49
- },
50
-
51
-
52
- },
53
- Box:{
54
- compiler:(value)=>{
55
- let result='';
56
- const match=/-([-]?[\w\.]+)/;
57
- const property=['width','height','padding'];
58
- value.match(new RegExp(match,'g')).forEach((e,i)=>{
3
+ Box:{
4
+ type:'group',
5
+ compiler:(value)=>{
6
+ const property=['width','height','padding','margin'];
7
+ let result='display:block; ';
8
+ const match=/-([-]?[\w\.]+)/;
9
+ value.match(new RegExp(match,'g')).forEach((e,i)=>{
59
10
  if(i<property.length){
60
11
  result+=`${property[i]}:${e.replace(match,'$1').replace(/(\d)d(\d)/,'$1.$2').replace(/([\d])p([\s]|$)/,'$1%$2')};`;
61
12
  }else{
62
-
63
13
  result=result.replace(/;$/,` ${e.replace(match,'$1').replace(/(\d)d(\d)/,'$1.$2').replace(/([\d])p([\s]|$)/,'$1%$2')};`)
64
- }
65
-
14
+ }
66
15
  })
67
16
  return result;
68
-
69
- },
70
- type:'group',
71
- groups:{
72
-
73
- }
74
17
  },
75
- Position:{
76
- 'alias':'pos',
77
- compiler:(value)=>{
78
- let result='';
79
- const match=/-([-]?[\w\.]+)/;
80
- const property=['position','top','right','bottom','left'];
81
- value.match(new RegExp(match,'g')).forEach((e,i)=>{
18
+ },
19
+ 'Flex-box':{
20
+ type:'group',
21
+ compiler:(value)=>{
22
+ const property=['flex-direction','justify-content','align-items','margin'];
23
+ let result='display:flex; ';
24
+ const match=/-([-]?[\w\.]+)/;
25
+ value.match(new RegExp(match,'g')).forEach((e,i)=>{
82
26
  if(i<property.length){
83
27
  result+=`${property[i]}:${e.replace(match,'$1').replace(/(\d)d(\d)/,'$1.$2').replace(/([\d])p([\s]|$)/,'$1%$2')};`;
84
- }
85
-
86
- })
87
- return result;
88
-
89
- },
90
- type:'group',
91
- groups:{
92
-
93
- }
94
- },
95
- Colorize:{
96
- 'alias':'pos',
97
- compiler:(value,custom)=>{
98
- let result='';
99
- const match=/-([-]?[\w\.]+)/;
100
- const property=['background-color','border-color','color',];
101
- value.match(new RegExp(match,'g')).forEach((e,i)=>{
102
-
103
- if(i<property.length){
104
- if(e.match(/^--[a-zA-Z]/)){
105
- result+=`${property[i]}:var(${e});`
106
- }else{
107
- result+=`${property[i]}:${getCompiler('color').compiler(e,custom)};`;
108
- }
109
- }
110
-
28
+ }else{
29
+ result=result.replace(/;$/,` ${e.replace(match,'$1').replace(/(\d)d(\d)/,'$1.$2').replace(/([\d])p([\s]|$)/,'$1%$2')};`)
30
+ }
111
31
  })
112
32
  return result;
113
-
114
- },
115
- type:'group',
116
- groups:{
117
-
118
- }
119
- },
120
- Container:{
121
- type:"group",
122
- compiler:(value)=>value,
123
- groups:{
124
- '1':'display:block;margin:auto;width:var(--container-1,448px)',
125
- '2':'display:block;margin:auto;width:var(--container-2,688px)',
126
- '3':'display:block;margin:auto;width:var(--container-3,880px)',
127
- '4':'display:block;margin:auto;width:var(--container-4,1136px)',
128
- 'xs':'display:block;margin:auto;width:var(--container-xs,448px)',
129
- 'sm':'display:block;margin:auto;width:var(--container-sm,688px)',
130
- 'md':'display:block;margin:auto;width:var(--container-md,880px)',
131
- 'lg':'display:block;margin:auto;width:var(--container-lg,1136px)',
132
- }
133
33
  },
134
- Section:{
135
- type:"group",
136
- compiler:(value)=>value,
137
- groups:{
138
- '1':'display:block;padding:var(--section-padding-1,24px) auto',
139
- '2':'display:block;padding:var(--section-padding-2,40px) auto',
140
- '3':'display:block;padding:var(--section-padding-3,64px) auto',
141
- '4':'display:block;padding:var(--section-padding-4,80px) auto',
142
- 'xs':'display:block;padding:var(--section-padding-xs,24px) auto',
143
- 'sm':'display:block;padding:var(--section-padding-sm,40px) auto',
144
- 'md':'display:block;padding:var(--section-padding-md,64px) auto',
145
- 'lg':'display:block;padding:var(--section-padding-lg,80px) auto',
146
-
147
- }
148
- }
34
+ },
35
+
149
36
  }
37
+
38
+ //Grid-box
39
+ //Flex-child
40
+ //Grid-child
41
+ //Color
42
+ //Container
43
+ //Section
44
+ //Text-size-lineHeight-letterSpacing-decoration
45
+ //Border-borderWidth-borderStyle-Border-color-borderRadius
46
+ //List
47
+ //Table