Skip to content

Commit

Permalink
fixed output path
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhad Ghayour committed Jan 27, 2015
1 parent 87ba228 commit 92665be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.DS_Store
node_modules
codemirror
21 changes: 8 additions & 13 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,11 @@ function parseStyles(styles) {
* Convert a given JSON to CSS and then display message after file has
* been written.
*/
function writeFile(json, themeName, outputDirectory, callback) {
function writeFile(json, themeName, callback) {
var data = CSSJSON.toCSS(json);
var destination = [__dirname];
var destination = __dirname+ '/' +themeName+ '.css'

if (outputDirectory) {
destination.push(outputDirectory);
}

fs.writeFile(destination.join(''), data, function(err) {
fs.writeFile(destination, data, function(err) {
if (err) console.log(err);
callback(themeName);
});
Expand Down Expand Up @@ -234,12 +230,12 @@ function printCompletedMessage(themeName) {
* Read the given theme file and send it off to be parsed.
* Once completed, send off the root JSON to be written to CSS.
*/
function convertTheme(themeName, themePath, outputDirectory, debug) {
function convertTheme(themeName, themePath, debug) {
var srcTheme = fs.readFileSync(__dirname + themePath, 'utf8');
parseTheme(srcTheme, function(theme) {
extractStyles(themeName, theme);
if (debug) print(root);
writeFile(root, themeName, outputDirectory, printCompletedMessage);
writeFile(root, themeName, printCompletedMessage);
});
}

Expand All @@ -258,14 +254,13 @@ function cleanPath(path) {
if (process.argv.length > 1) {
var args = process.argv.splice(2);
if (args.length < 2) {
console.error('Usage: [themeName] [pathToSrcFile] [pathToDestinationFile(optional)]');
console.error('Usage: themeName | sourcePath | debugMode (bool, optional)');
process.exit(1);
}
var themeName = args[0];
var themePath = cleanPath(args[1]);
var outputDirectory = cleanPath(args[2]);
var debug = args[3] ? true : false;
convertTheme(themeName, themePath, outputDirectory, debug);
var debug = args[2] ? true : false;
convertTheme(themeName, themePath, debug);
}


Expand Down

0 comments on commit 92665be

Please sign in to comment.