Sitelet https://github.com/ConciseCSS/concise.css/commit/ebf9d47faa8d8df057ab4e523ed664c3fa716a97
Skip to content

Commit ebf9d47

Browse files
Add -w flag
1 parent f6a470a commit ebf9d47

4 files changed

Lines changed: 19 additions & 30 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
## Installing the CLI Locally
66

7-
To install the Concise CLI in a project just run the following command:
7+
To install the Concise CLI in a project just run the following command:
88

99
```
1010
npm install -D ConciseCSS/concise.css#dev
1111
```
1212

1313
## Using Packages and Writing Styles
1414

15-
The Concise CLI can be used independently of any styles. In principle, it would will with any other CSS library, framework or any existing project so long as the code is plain CSS or contains only the features that can be compiled with PostCSS. Of course, one can start writing everything from scratch using Concise as well.
15+
The Concise CLI can be used independently of any styles. In principle, it would will with any other CSS library, framework or any existing project so long as the code is plain CSS or contains only the features that can be compiled with PostCSS. Of course, one can start writing everything from scratch using Concise as well.
1616

17-
The core library contains the very basic styles that one might use, and contains most of the code that was available on Concise v4. This can be installed by running:
17+
The core library contains the very basic styles that one might use, and contains most of the code that was available on Concise v4. This can be installed by running:
1818

1919
```
2020
npm install -D ConciseCSS/core#master
@@ -51,7 +51,7 @@ To execute the CLI manually after installing locally (without the `package.json`
5151
npx concise compile main.pcss main.css
5252
```
5353

54-
The equivalent `concise watch` command will also watch the files for changes.
54+
The flag `-w` will also watch the files for changes.
5555

5656
## Changelog
5757

‎bin/index.js‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
const fs = require('fs')
44
const path = require('path')
55
const concise = require('../src/index')
6+
const minimist = require('minimist')
67

78
const command = {
89
name: process.argv[2],
9-
input: process.argv[3],
10-
output: process.argv[4]
10+
flags: process.argv[3],
11+
input: process.argv[process.argv.length - 2],
12+
output: process.argv[process.argv.length - 1]
1113
}
1214

1315
const build = (input, output) => {
@@ -18,28 +20,24 @@ const build = (input, output) => {
1820
// Write the CSS
1921
fs.writeFile(output, result.css, err => {
2022
if (err) throw err
21-
console.log(`File written: ${output}\nFrom: ${input}`);
23+
console.log(`File written: ${output}\nFrom: ${input}`)
2224
})
23-
});
24-
};
25+
})
26+
}
2527

2628
const watch = path => {
27-
console.log(`Currently watching for changes in: ${path}`);
29+
console.log(`Currently watching for changes in: ${path}`)
2830

2931
fs.watch(path, {recursive: true}, (eventType, filename) => {
30-
console.log(`${eventType.charAt(0).toUpperCase() + eventType.slice(1)} in: ${filename}`);
31-
build();
32-
});
33-
};
32+
console.log(`${eventType.charAt(0).toUpperCase() + eventType.slice(1)} in: ${filename}`)
33+
build()
34+
})
35+
}
3436

3537
switch (command.name) {
3638
case 'compile':
37-
build(command.input, command.output);
38-
break
39-
40-
case 'watch':
41-
build(command.input, command.output);
42-
watch(path.dirname(command.input));
39+
build(command.input, command.output)
40+
if (command.flags === '-w') watch(path.dirname(command.input))
4341
break
4442

4543
default:

‎package-lock.json‎

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/index.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ const fs = require("fs")
22
const path = require('path')
33
const test = require('tape')
44
const postcss = require('postcss')
5-
const scssSyntax = require('postcss-scss')
65
const concise = require('../src/index.js')
76

87
;(() => {
98
const actual = async file => {
109
const sourcePath = path.join(__dirname,`fixtures/${file}/${file}.pcss`)
1110
const fileContent = fs.readFileSync(sourcePath, 'utf8')
1211

13-
const result = await postcss([concise]).process(fileContent, { from: sourcePath, parser: scssSyntax })
12+
const result = await postcss([concise]).process(fileContent, { from: sourcePath })
1413

1514
return result.css.replace(/\s+/g, '')
1615
}

0 commit comments

Comments
 (0)