-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In: Multiple Files (array), Out: Same Multiple Files (array) using .pleeeaserc #54
Comments
I would also like to add, it would be nice to either be able to specify a custom config, or parse through a JSON array in the .pleeeaserc. Something like this: {
"in": ["style.css"],
"out": "pleeease/style.css",
"browsers": ["last 3 versions", "Android 2.3"]
},
{
"in": ["media.css"],
"out": "pleeease/media.css",
"browsers": ["last 3 versions", "Android 2.3"]
} |
So I was actually able to implement a solution by parsing the config file in please-compile, then just reiterating over the multiple stylesheets in a single .pleeeaserc file. Basically I made a json array in the config file, and when we run the compile command, it does a for loop on each of the options, and then it runs var cli = new CLI(inputs, output).compile(); I first check to see if the config file HAS a length more than 1, if it doesn't it just uses the command above with no for loop. Would be nice to see something that implements a feature like this. Here is my final code for pleeease-compile file located in Roaming\npm\node_modules\pleeease-cli\bin: #!/usr/bin/env node
var fs = require('fs');
var extend = require('deep-extend');
//var util = require('util');
var CLI = require('../lib/cli');
var program = require('commander');
program.
option('-t, to [file]', 'save compiled files to [file] (default: "app.min.css")').
parse(process.argv);
var inputs = program.args;
var output = program.to;
var extendConfig = function (opts) {
opts = opts || {};
// read pleeeaserc
var config = {};
try {
var configFile = '.pleeeaserc';
config = JSON.parse(fs.readFileSync(configFile, 'utf-8'));
} finally {
return extend(opts, config);
}
};
var opts = extendConfig();
var styleCount = Object.keys(opts).length;
if( styleCount > 1 ){
for(var e = 0; e < styleCount; e++){
inputs = opts[e].in;
output = opts[e].out;
var cli = new CLI(inputs, output).compile();
}
}else{
var cli = new CLI(inputs, output).compile();
} |
Added a pull request for pleeease-cli. It may not be smart code, but I am sure we can figure it out. We're implementing the solution I came up with yesterday, so it would be nice to somehow integrate it in. I didn't change it up to where the whole process would change, just made an array .pleeeaserc. |
Any chance of having multiple files in OUT: anytime soon? This would be a very useful feature. |
Any news on this? |
So we have a unique situation where we have over 100 clients on 2 older versions of our app, and unfortunately, the 2 older versions are loading 2 different stylesheets. I know this isn't good practice, but our newest version of our app has it down to loading only 1. It would be great if we could somehow use the IN: array, for the OUT: path, and make it an array as well, and maybe have an option of multiple_files. When set to true, it would reiterate through the IN array, and output using the OUT array, so it's not combining all the INs to a single out.
The text was updated successfully, but these errors were encountered: