Giter Club home page Giter Club logo

Comments (5)

aolin480 avatar aolin480 commented on August 25, 2024

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"]
}

from pleeease.

aolin480 avatar aolin480 commented on August 25, 2024

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();
}

from pleeease.

aolin480 avatar aolin480 commented on August 25, 2024

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.

https://github.com/aolin480/pleeease-cli

from pleeease.

alexradulescu avatar alexradulescu commented on August 25, 2024

Any chance of having multiple files in OUT: anytime soon? This would be a very useful feature.

from pleeease.

OmgImAlexis avatar OmgImAlexis commented on August 25, 2024

Any news on this?

from pleeease.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.