-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from xtyrrell/feature/include-hidden
feat: add --include-hidden flag
- Loading branch information
Showing
17 changed files
with
140 additions
and
15 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.primary { | ||
color: blue; | ||
margin: 10px; | ||
} |
1 change: 1 addition & 0 deletions
1
tests/examples/with-hidden-variables-file/less/.other-variables.less
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 @@ | ||
@default-spacing: 10px; |
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 @@ | ||
@primary-colour: blue; |
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,7 @@ | ||
@import '_variables.less'; | ||
@import '.other-variables.less'; | ||
|
||
.primary { | ||
color: @primary-colour; | ||
margin: @default-spacing; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
const assert = require('assert'); | ||
const child_process = require('child_process'); | ||
const fs = require('fs'); | ||
const sh = require('shelljs'); | ||
|
||
const cwd = sh.pwd().toString(); | ||
|
||
function runLessWatchCompiler(argumentsAndOptions, callback) { | ||
return child_process.exec(cwd + '/dist/less-watch-compiler.js ' + argumentsAndOptions, callback) | ||
} | ||
|
||
describe('Using the CLI in example projects', function () { | ||
describe('with-hidden-variables-file', function () { | ||
const lessDir = cwd + '/tests/examples/with-hidden-variables-file/less' | ||
const cssDir = cwd + '/tests/examples/with-hidden-variables-file/css' | ||
|
||
it('should compile main.css correctly', function (done) { | ||
// Make sure we're testing against the main.css file compiled by this test run | ||
fs.rmSync(cssDir + '/main.css', { force: true }) | ||
|
||
runLessWatchCompiler(lessDir + ' ' + cssDir + " --include-hidden") | ||
|
||
// Wait for compilation to happen | ||
setTimeout(function () { | ||
const contents = fs.readFileSync(cssDir + '/main.css') | ||
const contentsExpected = fs.readFileSync(cssDir + '/expected.css') | ||
|
||
assert.ok(contents.equals(contentsExpected)) | ||
|
||
fs.rmSync(cssDir + '/main.css', { force: true }) | ||
|
||
done() | ||
}, 500) | ||
}) | ||
|
||
it('should not compile the hidden variables files', function (done) { | ||
const compiledVariablesPath = cssDir + '/_variables.css' | ||
const compiledOtherVariablesPath = cssDir + '/.other-variables.css' | ||
|
||
// Make sure we don't detect compiled variables files left over from other runs | ||
fs.rmSync(compiledVariablesPath, { force: true }) | ||
fs.rmSync(compiledOtherVariablesPath, { force: true }) | ||
|
||
runLessWatchCompiler(lessDir + ' ' + cssDir + " --include-hidden") | ||
|
||
// Wait for compilation to happen | ||
setTimeout(function () { | ||
console.log("ls css:" + child_process.execSync("ls " + cssDir)) | ||
|
||
const variablesFilesWereNotCompiled = !fs.existsSync(compiledVariablesPath) && | ||
!fs.existsSync(compiledOtherVariablesPath) | ||
|
||
assert.ok(variablesFilesWereNotCompiled) | ||
done() | ||
}, 500) | ||
}) | ||
}) | ||
}) |
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,3 @@ | ||
.hidden2 { | ||
color: transparent; | ||
} |
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,3 @@ | ||
.hidden { | ||
color: black; | ||
} |
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