Sha256: 271c90b44aebae511a128bb577acf185b7c23aa763fcfd6c48ca17be6aa11cf2

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

#!/usr/bin/env node

const postcss = require(require.resolve("postcss", {paths: [process.cwd()]}));
const config = require(`${process.cwd()}/postcss.config.js`);
const net = require("net");

const server = net.createServer((c) => {
  c.on('data', (data) => {
    postcss(config.plugins)
      .process(JSON.parse(data).raw_content, {from: "stdin"})
      .then(result => {
        const packet = { compiled_css: result.toString() };
        c.write(`${JSON.stringify(packet)}\n`);

        return;
      })
      .catch(error => {
        console.log("PostCSS Error!\n");
        console.log(error.toString());
      });
  });
});

server.on('error', (err) => {
  console.log("PostCSS Server Error!\n");
  throw err;
});

server.listen(8124, () => {
  console.log("PostCSS Server listening on port 8124...");
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-postcss-0.3.0 bin/postcss