Skip to content
This repository was archived by the owner on Jun 5, 2018. It is now read-only.
YU HengChun edited this page Oct 24, 2017 · 3 revisions

Customize parameters

const
  powcss =require('powcss'),
  context =require('powcss/lib/context'),
  Color = require('color');

  function myColor(colorString) {
    return Color(colorString).alpha(0.5).lighten(0.5).rgb().string()
  }

  powcss().run(
    'div\n  color: ${Color("#7743CE").alpha(0.5).lighten(0.5).rgb().string()}\n'+
    'pre\n  color: ${myColor("#7743CE")}',
    'ctx,Color,myColor',        // parameters
    [context(), Color, myColor] // arguments
  );

Embed a function

const
  powcss =require('powcss');

  powcss().run(
    'let axb = function (a, b) {return a * b};\n'+
    'div\n  width: ${axb(2, 6)}px\n'
  );

Clone this wiki locally