-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(formats): add stylus/variables format
Although leading dollar signs are not mandatory for stylus variables there is a trend to having this, so I also included it in this PR. see https://gist.github.com/zspecza/7220997#why refs #526
- Loading branch information
1 parent
5ad2d41
commit 8c22eb2
Showing
5 changed files
with
178 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
var formats = require('../../lib/common/formats'); | ||
var stylus = require('stylus'); | ||
|
||
var file = { | ||
"destination": "__output/", | ||
"format": "stylus/variables", | ||
"name": "foo" | ||
}; | ||
|
||
var propertyName = "color-base-red-400"; | ||
var propertyValue = "#EF5350"; | ||
|
||
var dictionary = { | ||
"allProperties": [{ | ||
"name": propertyName, | ||
"value": propertyValue, | ||
"original": { | ||
"value": propertyValue | ||
}, | ||
"attributes": { | ||
"category": "color", | ||
"type": "base", | ||
"item": "red", | ||
"subitem": "400" | ||
}, | ||
"path": [ | ||
"color", | ||
"base", | ||
"red", | ||
"400" | ||
] | ||
}] | ||
}; | ||
|
||
var formatter = formats['stylus/variables'].bind(file); | ||
|
||
describe('formats', () => { | ||
describe('stylus/variables', () => { | ||
|
||
it('should have a valid stylus syntax', done => { | ||
stylus.render(formatter(dictionary), | ||
function (err, css) { | ||
if (err) { | ||
return done(new Error(err)); | ||
} | ||
expect(css).toBeDefined(); | ||
return done(); | ||
}); | ||
}); | ||
|
||
}); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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