Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tidying up
  • Loading branch information
geelen committed Sep 13, 2015
commit 7b2501f3b332387ff95166442b6f19dd88903154
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export default class Core {
Core.localByDefault = localByDefault
Core.extractImports = extractImports
Core.scope = scope
Core.defaultPlugins = [wip, css => console.log(css.toResult().css), localByDefault, extractImports, scope]
Core.defaultPlugins = [wip, localByDefault, extractImports, scope]
4 changes: 3 additions & 1 deletion src/wip.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export default css => {
}
})

console.log(translations)
/* If we have no translations, don't continue */
if (!Object.keys(translations).length) return

/* Perform replacements */
replaceSymbols(css, translations)

Expand Down
39 changes: 19 additions & 20 deletions test/test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Object.keys( pipelines ).forEach( dirname => {
describe( dirname, () => {
let testDir = path.join( __dirname, dirname )
fs.readdirSync( testDir ).forEach( testCase => {
if (testCase !== 'aliases') return
if ( fs.existsSync( path.join( testDir, testCase, "source.css" ) ) ) {
it( "should " + testCase.replace( /-/g, " " ), done => {
let expected = normalize( fs.readFileSync( path.join( testDir, testCase, "expected.css" ), "utf-8" ) )
Expand All @@ -35,22 +34,22 @@ Object.keys( pipelines ).forEach( dirname => {
} )

// special case for testing multiple sources
//describe( 'multiple sources', () => {
// let testDir = path.join( __dirname, 'test-cases' )
// let testCase = 'multiple-sources';
// let dirname = 'test-cases';
// if ( fs.existsSync( path.join( testDir, testCase, "source1.css" ) ) ) {
// it( "should " + testCase.replace( /-/g, " " ), done => {
// let expected = normalize( fs.readFileSync( path.join( testDir, testCase, "expected.css" ), "utf-8" ) )
// let loader = new FileSystemLoader( testDir, pipelines[dirname] )
// let expectedTokens = JSON.parse( fs.readFileSync( path.join( testDir, testCase, "expected.json" ), "utf-8" ) )
// loader.fetch( `${testCase}/source1.css`, "/" ).then( tokens1 => {
// loader.fetch( `${testCase}/source2.css`, "/" ).then( tokens2 => {
// assert.equal( loader.finalSource, expected )
// const tokens = Object.assign({}, tokens1, tokens2);
// assert.equal( JSON.stringify( tokens ), JSON.stringify( expectedTokens ) )
// } ).then( done, done )
// })
// } );
// }
//} );
describe( 'multiple sources', () => {
let testDir = path.join( __dirname, 'test-cases' )
let testCase = 'multiple-sources';
let dirname = 'test-cases';
if ( fs.existsSync( path.join( testDir, testCase, "source1.css" ) ) ) {
it( "should " + testCase.replace( /-/g, " " ), done => {
let expected = normalize( fs.readFileSync( path.join( testDir, testCase, "expected.css" ), "utf-8" ) )
let loader = new FileSystemLoader( testDir, pipelines[dirname] )
let expectedTokens = JSON.parse( fs.readFileSync( path.join( testDir, testCase, "expected.json" ), "utf-8" ) )
loader.fetch( `${testCase}/source1.css`, "/" ).then( tokens1 => {
loader.fetch( `${testCase}/source2.css`, "/" ).then( tokens2 => {
assert.equal( loader.finalSource, expected )
const tokens = Object.assign({}, tokens1, tokens2);
assert.equal( JSON.stringify( tokens ), JSON.stringify( expectedTokens ) )
} ).then( done, done )
})
} );
}
} );
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
._aliases_borders__dashed {
._constants_borders__dashed {
border: 4px dashed;
}


._aliases_source__foo {
._constants_source__foo {
background: aquamarine;
border-color: red;
}

@media (max-width: 599px) {
._aliases_source__foo {
._constants_source__foo {
background: white;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"borders": "\"./borders.css\"",
"breakpoints": "\"./breakpoints.css\"",
"foo": "_aliases_source__foo _aliases_borders__dashed"
"foo": "_constants_source__foo _constants_borders__dashed"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@let borders: "./borders.css", breakpoints: "./breakpoints.css";
@import small from breakpoints;
@-import small from breakpoints;
@import secondary, primary as blue from "./colors.css";

.foo {
Expand Down