Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « node « postcss « examples - github.com/twbs/rfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4b77acb41776cc588ab4e7a5b39878ec4f5f7068 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require('fs');
const postcss = require('postcss');
const rfs = require('../../..');
const css = fs.readFileSync(__dirname + '/src/main.css', 'utf8');
const options = {
  twoDimensional: false,
  baseFontSize: 16,
  fontSizeUnit: 'rem',
  breakpoint: '75rem',
  breakpointUnit: 'px',
  factor: 5,
  unitPrecision: 6,
  remValue: 16,
  propList: ['responsive-font-size', 'rfs']
};

const processedCss = postcss(rfs(options)).process(css).css;

fs.writeFile(__dirname + '/dest/main.css', processedCss, (err) => {
  if (err) {
    throw err;
  }
  else {
    console.log('Responsive font sizes generated.');
  }
});