Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

Commit f68a88a

Browse files
author
James Kolce
committed
Initial commit
0 parents  commit f68a88a

11 files changed

Lines changed: 140 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
.idea/

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 James Kolce
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# concise-cli
2+
CLI for Concise Framework

‎index.js‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const cliparse = require('cliparse');
4+
const pkg = require('./package.json');
5+
const fs = require('fs');
6+
7+
const compile = require('./lib/compile');
8+
9+
cliparse.parse(cliparse.cli({
10+
name: 'concise-cli',
11+
description: 'Command-line Interface for Concise Framework',
12+
version: pkg.version,
13+
commands: [
14+
cliparse.command(
15+
'compile',
16+
{ description: 'Compile code from Concise Framework',
17+
args: [
18+
cliparse.argument('input', { description: 'File to compile' }),
19+
cliparse.argument('output', { description: 'Output CSS file' })
20+
]
21+
}, (params) => {
22+
fs.writeFile(params.args[1], compile(params.args[0]), (err) => {
23+
if (err) {
24+
throw err;
25+
}
26+
27+
console.log(`File written: ${params.args[1]}\nFrom: ${params.args[0]}`);
28+
})
29+
}
30+
)
31+
]
32+
}));

‎lib/compile.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const sass = require('node-sass');
2+
const postcss = require('postcss');
3+
const customMedia = require('postcss-custom-media');
4+
const mediaMinMax = require('postcss-media-minmax');
5+
6+
module.exports = (file) => {
7+
var compiledSass = sass.renderSync({
8+
file: file
9+
}).css;
10+
11+
return postcss().use(customMedia()).use(mediaMinMax()).process(compiledSass).css;
12+
};

‎package.json‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "concise-cli",
3+
"version": "0.1.0",
4+
"description": "Command-line Interface for Concise Framework",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "tape test"
8+
},
9+
"author": "James Kolce <contact@jameskolce.com>",
10+
"license": "MIT",
11+
"dependencies": {
12+
"cliparse": "^0.2.5",
13+
"node-sass": "^3.7.0",
14+
"postcss": "^5.0.21",
15+
"postcss-custom-media": "^5.0.1",
16+
"postcss-media-minmax": "^2.1.2"
17+
},
18+
"devDependencies": {
19+
"tape": "^4.5.1"
20+
}
21+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@media (max-width: 30em) {
2+
.element {
3+
width: 50%; } }
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@custom-media --small-viewport (max-width: 30em);
2+
3+
$width: 50%;
4+
5+
@media (--small-viewport) {
6+
.element {
7+
width: $width;
8+
}
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@media (max-width: 30em) {
2+
.element {
3+
width: 50%; } }
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@custom-media --small-viewport (width <= 30em);
2+
3+
$width: 50%;
4+
5+
@media (--small-viewport) {
6+
.element {
7+
width: $width;
8+
}
9+
}

0 commit comments

Comments
 (0)