Comparing version 0.0.5 to 0.0.6
@@ -105,3 +105,9 @@ /* | ||
var template = handlebars.compile(fs.readFileSync(templateFile).toString()); | ||
return template(variable.theme); | ||
var result = template(variable.theme); | ||
console.log('res ' + result); | ||
// A Handlebar bug replaces single quotes with ' | ||
// which has to be reverted. | ||
result = result.replace(/'/g, "'"); | ||
return result; | ||
}else{ | ||
@@ -108,0 +114,0 @@ throw new Error('No template for convertion type: ' + type); |
{ | ||
"name": "theo", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Theme tokenizer working with JSON input generating variables for Sass, Stylus, Less, Aura, iOS (plist) and Android (XML)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -41,3 +41,3 @@ theo | ||
You could also start by cloning one if the [mock files](test/mock/s1base.json). | ||
You could also start by cloning one of the [mock files](test/mock/s1base.json). | ||
@@ -52,2 +52,10 @@ ## Test | ||
[BSD 2-Clause License](LICENSE) | ||
Copyright (c) 2014, salesforce.com, inc. All rights reserved. | ||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
@@ -15,2 +15,7 @@ { | ||
"value":"#006eb3" | ||
}, | ||
{ | ||
"name":"FONT_BOLD", | ||
"value":"'ProximaNovaSoft-Bold'", | ||
"comment": "Fonts" | ||
} | ||
@@ -17,0 +22,0 @@ ] |
@@ -76,4 +76,4 @@ /* | ||
var result = theo.convert('Sass', s1Base); | ||
assert(result, 'result does not exist'); | ||
assert(result.indexOf('$color-primary: #2a94d6;') != -1, 'Could not find primary color.'); | ||
result.should.exist; | ||
result.should.containEql('$color-primary: #2a94d6;'); | ||
}); | ||
@@ -88,5 +88,4 @@ | ||
var result = theo.convert('Stylus', s1Base); | ||
assert(result, 'result does not exist'); | ||
//console.log(result); | ||
assert(result.indexOf('color-primary = #2a94d6') != -1, 'Could not find primary color.'); | ||
result.should.exist; | ||
result.should.containEql('color-primary = #2a94d6'); | ||
}); | ||
@@ -101,5 +100,4 @@ | ||
var result = theo.convert('Less', s1Base); | ||
assert(result, 'result does not exist'); | ||
//console.log(result); | ||
assert(result.indexOf('@color-primary: #2a94d6;') != -1, 'Could not find primary color.'); | ||
result.should.exist; | ||
result.should.containEql('@color-primary: #2a94d6;'); | ||
}); | ||
@@ -114,11 +112,18 @@ | ||
var result = theo.convert('Aura', json); | ||
assert(result, 'result does not exist'); | ||
assert(result.indexOf('<aura:theme >') != -1, 'Could not find main aura tag.'); | ||
assert(result.indexOf('<aura:var name="colorPrimary" value="#2a94d6" />') != -1, 'Could not find primary color.'); | ||
result.should.exist; | ||
result.should.containEql('<aura:theme >'); | ||
result.should.containEql('<aura:var name="colorPrimary" value="#2a94d6" />'); | ||
}); | ||
it('should preserve single quotes.', function(){ | ||
json = JSON.parse(fs.readFileSync('./test/mock/s1base.json').toString()); | ||
var result = theo.convert('Aura', json); | ||
result.should.exist; | ||
result.should.containEql('<aura:var name="fontBold" value="\'ProximaNovaSoft-Bold\'" />'); | ||
}); | ||
it('should add extends if JSON is extending a base.', function(){ | ||
json = JSON.parse(fs.readFileSync('./test/mock/s1sub.json').toString()); | ||
var result = theo.convert('Aura', json); | ||
assert(result.indexOf('<aura:theme extends="one:theme">') != -1, 'Could not find main aura tag with extends.'); | ||
result.should.containEql('<aura:theme extends="one:theme">'); | ||
}); | ||
@@ -133,5 +138,5 @@ | ||
var result = theo.convert('plist', json); | ||
assert(result, 'result does not exist'); | ||
assert(result.indexOf('<key>COLOR_PRIMARY</key>') != -1, 'Could not find primary color.'); | ||
assert(result.indexOf('<string>#2a94d6</string>') != -1, 'Could not find primary color value.'); | ||
result.should.exist; | ||
result.should.containEql('<key>COLOR_PRIMARY</key>'); | ||
result.should.containEql('<string>#2a94d6</string>'); | ||
}); | ||
@@ -146,4 +151,4 @@ | ||
var result = theo.convert('XML', json); | ||
assert(result, 'result does not exist'); | ||
assert(result.indexOf('<variable name="COLOR_PRIMARY" value="#2a94d6" />') != -1, 'Could not find primary color.'); | ||
result.should.exist; | ||
result.should.containEql('<variable name="COLOR_PRIMARY" value="#2a94d6" />'); | ||
}); | ||
@@ -158,4 +163,4 @@ | ||
var result = theo.convert('HTML', json); | ||
assert(result, 'result does not exist'); | ||
assert(result.indexOf('<h1>Salesforce Brand</h1>') != -1, 'Could not find main Salasforce Brand tag.'); | ||
result.should.exist; | ||
result.should.containEql('<h1>Salesforce Brand</h1>'); | ||
}); | ||
@@ -162,0 +167,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22735
276
59