@bolt/sass-export-data
Export Sass as JSON data
Last updated 3 months ago by sghoweri .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @bolt/sass-export-data 
SYNC missed versions from official npm registry.

Sass Export Data

Uses custom functions in node-sass to export JSON files from Sass maps and other variables.

Install

npm install --save @theme-tools/sass-export-data

Setup

const config = {
  name: 'export_data', // Name of Sass function
  path: 'path/to/export/folder/' // Folder where to place JSON files
};
const sassExportData = require('@theme-tools/sass-export-data')(config);

Then pass sassExportData to the functions option in node-sass. It'll be the object like it wants, so you could merge it with other functions if needed. This can work with many ways to compile sass: gulp, webpack, basic cli, or anything that utilizes node-sass.

Usage

In your sass declare this mixin to make it easier:

/// Export Sass Data to JSON in `path/to/export/folder/` folder
/// @param {String} $filename - ie `mystuff.json`
/// @param $var - What to turn into JSON
/// @example scss
///   @include export-data-to-lib('filename.json', $sass-map);
@mixin export-data($filename, $var) {
  // The `export_data` function is a custom function added to Sass.
  // The `$data` var is weird, but needed.
  $data: export_data($filename, $var);
};

Then you can do this wherever you'd like:

$x: (
  a: 'Apple',
  b: 'Beer',
);

@include export-data('example.json', $x);

This will create the file example.json in path/to/export/folder/ with:

{
  "a": "Apple",
  "b": "Beer"
}

Details

  • If the file hasn't changed, it won't output. That helps watchers go less crazy.

Special thanks to node-sass-export for inspiration and much of the original code.

Current Tags

  • 2.23.0-canary.12672.5.0                                ...           canary (24 days ago)
  • 2.19.0                                ...           latest (3 months ago)
  • 2.4.0-beta.0                                ...           next (a year ago)

262 Versions

  • 2.23.0-canary.12672.5.0                                ...           24 days ago
  • 2.23.0-canary.12670.5.0                                ...           25 days ago
  • 2.23.0-canary.12666.5.0                                ...           25 days ago
  • 2.23.0-canary.12664.5.0                                ...           25 days ago
  • 2.23.0-canary.12662.5.0                                ...           25 days ago
  • 2.23.0-canary.12658.5.0                                ...           25 days ago
  • 2.23.0-canary.12656.5.0                                ...           25 days ago
  • 2.23.0-canary.12655.5.0                                ...           25 days ago
  • 2.23.0-canary.12648.5.0                                ...           a month ago
  • 2.23.0-canary.12640.5.0                                ...           a month ago
  • 2.23.0-canary.12634.5.0                                ...           a month ago
  • 2.23.0-canary.12620.5.0                                ...           a month ago
  • 2.23.0-canary.12617.5.0                                ...           a month ago
  • 2.23.0-canary.12615.5.0                                ...           a month ago
  • 2.23.0-canary.12612.5.0                                ...           a month ago
  • 2.23.0-canary.12573.5.0                                ...           a month ago
  • 2.23.0-canary.12570.5.0                                ...           a month ago
  • 2.23.0-canary.12560.5.0                                ...           a month ago
  • 2.23.0-canary.12555.5.0                                ...           a month ago
  • 2.23.0-canary.12551.5.0                                ...           a month ago
  • 2.23.0-canary.12548.5.0                                ...           a month ago
  • 2.23.0-canary.12544.5.0                                ...           a month ago
  • 2.22.2-canary.12540.5.0                                ...           a month ago
  • 2.22.1-canary.12533.5.0                                ...           a month ago
  • 2.22.0-canary.12522.5.0                                ...           a month ago
  • 2.22.0-canary.12518.5.0                                ...           a month ago
  • 2.22.0-canary.12517.5.0                                ...           a month ago
  • 2.22.0-canary.12485.5.0                                ...           a month ago
  • 2.22.0-canary.12482.5.0                                ...           a month ago
  • 2.22.0-canary.12471.5.0                                ...           a month ago
  • 2.22.0-canary.12464.5.0                                ...           a month ago
  • 2.22.0-canary.12458.5.0                                ...           a month ago
  • 2.22.0-canary.12445.5.0                                ...           2 months ago
  • 2.22.0-canary.12437.5.0                                ...           2 months ago
  • 2.22.0-canary.12435.5.0                                ...           2 months ago
  • 2.22.0-canary.12432.5.0                                ...           2 months ago
  • 2.22.0-canary.12430.5.0                                ...           2 months ago
  • 2.22.0-canary.12427.5.0                                ...           2 months ago
  • 2.22.0-canary.12418.5.0                                ...           2 months ago
  • 2.22.0-canary.12412.5.0                                ...           2 months ago
  • 2.22.0-canary.12406.5.0                                ...           2 months ago
  • 2.21.0-canary.12395.5.0                                ...           2 months ago
  • 2.21.0-canary.12394.5.0                                ...           2 months ago
  • 2.21.0-canary.12392.5.0                                ...           2 months ago
  • 2.21.0-canary.12390.5.0                                ...           2 months ago
  • 2.21.0-canary.12384.5.0                                ...           2 months ago
  • 2.21.0-canary.12371.5.0                                ...           2 months ago
  • 2.21.0-canary.12369.5.0                                ...           2 months ago
  • 2.21.0-canary.12352.5.0                                ...           2 months ago
  • 2.21.0-canary.12349.5.0                                ...           2 months ago
  • 2.21.0-canary.12348.5.0                                ...           2 months ago
  • 2.21.0-canary.12345.5.0                                ...           2 months ago
  • 2.21.0-canary.12337.5.0                                ...           2 months ago
  • 2.21.0-canary.12324.5.0                                ...           2 months ago
  • 2.21.0-canary.12312.5.0                                ...           2 months ago
  • 2.21.0-canary.12310.5.0                                ...           2 months ago
  • 2.21.0-canary.12309.5.0                                ...           2 months ago
  • 2.21.0-canary.12300.5.0                                ...           2 months ago
  • 2.20.2-canary.12297.5.0                                ...           2 months ago
  • 2.20.2-canary.12294.5.0                                ...           2 months ago
  • 2.20.1-canary.12283.5.0                                ...           2 months ago
  • 2.20.1-canary.12259.5.0                                ...           2 months ago
  • 2.20.1-canary.12257.5.0                                ...           2 months ago
  • 2.20.1-canary.12250.5.0                                ...           2 months ago
  • 2.20.0-canary.12222.5.0                                ...           2 months ago
  • 2.20.0-canary.12206.5.0                                ...           3 months ago
  • 2.19.2-canary.12200.5.0                                ...           3 months ago
  • 2.19.1-canary.12191.5.0                                ...           3 months ago
  • 2.19.1-canary.12182.5.0                                ...           3 months ago
  • 2.19.1-canary.12170.5.0                                ...           3 months ago
  • 2.19.0                                ...           3 months ago
  • 2.19.0-canary.12156.5.0                                ...           3 months ago
  • 2.19.0-canary.12151.5.0                                ...           3 months ago
  • 2.19.0-canary.12150.5.0                                ...           3 months ago
  • 2.19.0-canary.12146.5.0                                ...           3 months ago
  • 2.19.0-canary.12145.5.0                                ...           3 months ago
  • 2.19.0-canary.12138.5.0                                ...           3 months ago
  • 2.19.0-canary.12120.5.0                                ...           3 months ago
  • 2.19.0-canary.12118.5.0                                ...           3 months ago
  • 2.19.0-canary.12104.5.0                                ...           3 months ago
  • 2.19.0-canary.12091.5.0                                ...           3 months ago
  • 2.18.2-canary.12075.5.0                                ...           3 months ago
  • 2.18.2-canary.12071.5.0                                ...           3 months ago
  • 2.18.0-canary.12057.5.0                                ...           3 months ago
  • 2.18.0-canary.12055.5.0                                ...           3 months ago
  • 2.18.0-canary.12045.5.0                                ...           3 months ago
  • 2.18.0-canary.12035.5.0                                ...           3 months ago
  • 2.18.0-canary.12034.5.0                                ...           3 months ago
  • 2.18.0-canary.12033.5.0                                ...           3 months ago
  • 2.18.0-canary.12032.5.0                                ...           3 months ago
  • 2.18.0-canary.12030.5.0                                ...           4 months ago
  • 2.18.0-canary.12025.5.0                                ...           4 months ago
  • 2.18.0-canary.12023.5.0                                ...           4 months ago
  • 2.18.0-canary.12022.5.0                                ...           4 months ago
  • 2.18.0-canary.12019.5.0                                ...           4 months ago
  • 2.18.0-canary.12018.5.0                                ...           4 months ago
  • 2.18.0-canary.12013.5.0                                ...           4 months ago
  • 2.18.0-canary.12012.5.0                                ...           4 months ago
  • 2.18.0-canary.12011.5.0                                ...           4 months ago
  • 2.18.0-canary.11977.5.0                                ...           4 months ago
  • 2.18.0-canary.11996.5.0                                ...           4 months ago
  • 2.18.0-canary.11994.5.0                                ...           4 months ago
  • 2.18.0-canary.11986.5.0                                ...           4 months ago
  • 2.17.1-canary.11976.5.0                                ...           4 months ago
  • 2.17.0                                ...           4 months ago
  • 2.17.0-canary.11975.5.0                                ...           4 months ago
  • 2.17.0-canary.11966.5.0                                ...           4 months ago
  • 2.17.0-canary.11957.5.0                                ...           4 months ago
  • 2.17.0-canary.11956.5.0                                ...           4 months ago
  • 2.17.0-canary.11955.5.0                                ...           4 months ago
  • 2.17.0-canary.11948.5.0                                ...           4 months ago
  • 2.17.0-canary.11947.5.0                                ...           4 months ago
  • 2.17.0-canary.11931.5.0                                ...           4 months ago
  • 2.17.0-canary.11929.5.0                                ...           4 months ago
  • 2.17.0-canary.11923.5.0                                ...           4 months ago
  • 2.17.0-canary.11922.5.0                                ...           4 months ago
  • 2.17.0-canary.11910.5.0                                ...           4 months ago
  • 2.17.0-canary.11909.5.0                                ...           4 months ago
  • 2.17.0-canary.11902.5.0                                ...           4 months ago
  • 2.17.0-canary.11889.5.0                                ...           4 months ago
  • 2.17.0-canary.11880.5.0                                ...           4 months ago
  • 2.17.0-canary.11878.5.0                                ...           4 months ago
  • 2.17.0-canary.11877.5.0                                ...           4 months ago
  • 2.16.0                                ...           4 months ago
  • 2.16.0-canary.11870.5.0                                ...           4 months ago
  • 2.16.0-canary.11857.5.0                                ...           4 months ago
  • 2.16.0-canary.11829.5.0                                ...           4 months ago
  • 2.16.0-canary.11827.5.0                                ...           4 months ago
  • 2.15.3-canary.11820.5.0                                ...           4 months ago
  • 2.15.3-canary.11797.5.0                                ...           4 months ago
  • 2.15.2-canary.11785.5.0                                ...           4 months ago
  • 2.15.2                                ...           4 months ago
  • 2.15.2-canary.11781.5.0                                ...           4 months ago
  • 2.15.1-canary.11765.5.0                                ...           4 months ago
  • 2.15.1-canary.11764.5.0                                ...           4 months ago
  • 2.15.0-canary.11760.5.0                                ...           4 months ago
  • 2.15.0                                ...           4 months ago
  • 2.15.0-canary.11722.5.0                                ...           4 months ago
  • 2.15.0-canary.11706.5.0                                ...           4 months ago
  • 2.15.0-canary.11702.5.0                                ...           4 months ago
  • 2.15.0-canary.11686.5.0                                ...           4 months ago
  • 2.15.0-canary.11679.5.0                                ...           4 months ago
  • 2.15.0-canary.11674.5.0                                ...           4 months ago
  • 2.15.0-canary.11659.5.0                                ...           5 months ago
  • 2.15.0-canary.11639.5.0                                ...           5 months ago
  • 2.15.0-canary.11605.5.0                                ...           5 months ago
  • 2.15.0-canary.11599.5.0                                ...           5 months ago
  • 2.15.0-canary.11591.5.0                                ...           5 months ago
  • 2.15.0-canary.11590.5.0                                ...           5 months ago
  • 2.15.0-canary.11588.5.0                                ...           5 months ago
  • 2.15.0-canary.11565.5.0                                ...           5 months ago
  • 2.15.0-canary.11558.5.0                                ...           5 months ago
  • 2.15.0-canary.11557.5.0                                ...           5 months ago
  • 2.14.1-canary.11548.5.0                                ...           5 months ago
  • 2.14.1-canary.11513.5.0                                ...           5 months ago
  • 2.14.0-canary.11511.5.0                                ...           5 months ago
  • 2.14.0                                ...           5 months ago
  • 2.14.0-canary.11506.5.0                                ...           5 months ago
  • 2.14.0-canary.11502.5.0                                ...           5 months ago
  • 2.14.0-canary.11501.5.0                                ...           5 months ago
  • 2.14.0-canary.11498.5.0                                ...           5 months ago
  • 2.14.0-canary.11492.5.0                                ...           5 months ago
  • 2.14.0-canary.11481.5.0                                ...           5 months ago
  • 2.14.0-canary.11477.5.0                                ...           5 months ago
  • 2.14.0-canary.11473.5.0                                ...           5 months ago
  • 2.14.0-canary.11467.5.0                                ...           5 months ago
  • 2.14.0-canary.11463.5.0                                ...           5 months ago
  • 2.14.0-canary.11406.5.0                                ...           5 months ago
  • 2.14.0-canary.11403.5.0                                ...           5 months ago
  • 2.14.0-canary.11399.5.0                                ...           5 months ago
  • 2.14.0-canary.11389.5.0                                ...           5 months ago
  • 2.14.0-canary.11374.5.0                                ...           5 months ago
  • 2.14.0-canary.11372.5.0                                ...           5 months ago
  • 2.14.0-canary.11359.5.0                                ...           5 months ago
  • 2.14.0-canary.11357.5.0                                ...           5 months ago
  • 2.14.0-canary.11344.5.0                                ...           5 months ago
  • 2.14.0-canary.11322.5.0                                ...           5 months ago
  • 2.14.0-canary.11311.5.0                                ...           5 months ago
  • 2.13.1-canary.11309.5.0                                ...           6 months ago
  • 2.13.0-canary.11303.5.0                                ...           6 months ago
  • 2.13.0-canary.11274.6.0                                ...           6 months ago
  • 2.13.0-canary.11269.6.0                                ...           6 months ago
  • 2.13.0-canary.11268.6.0                                ...           6 months ago
  • 2.13.0-canary.11267.6.0                                ...           6 months ago
  • 2.13.0-canary.11210.6.0                                ...           6 months ago
  • 2.13.0-canary.11192.6.0                                ...           6 months ago
  • 2.13.0-canary.11180.6.0                                ...           6 months ago
  • 2.13.0-canary.11178.6.0                                ...           6 months ago
  • 2.13.0-canary.11141.6.0                                ...           6 months ago
  • 2.13.0-canary.11117.6.0                                ...           6 months ago
  • 2.13.0-canary.11116.6.0                                ...           6 months ago
  • 2.13.0-canary.11115.6.0                                ...           6 months ago
  • 2.13.0-canary.11114.6.0                                ...           6 months ago
  • 2.13.0-canary.11111.6.0                                ...           6 months ago
  • 2.13.0-canary.11102.6.0                                ...           6 months ago
  • 2.12.0                                ...           6 months ago
  • 2.12.0-canary.11099.6.0                                ...           6 months ago
  • 2.12.0-canary.11095.6.0                                ...           6 months ago
  • 2.12.0-canary.11083.6.0                                ...           6 months ago
  • 2.12.0-canary.11081.6.0                                ...           6 months ago
  • 2.12.0-canary.11079.6.0                                ...           6 months ago
  • 2.12.0-canary.11075.6.0                                ...           6 months ago
  • 2.12.0-canary.11073.6.0                                ...           6 months ago
  • 2.12.0-canary.11044.6.0                                ...           6 months ago
  • 2.12.0-canary.11041.6.0                                ...           6 months ago
  • 2.12.0-canary.11034.6.0                                ...           6 months ago
  • 2.12.0-canary.11019.6.0                                ...           6 months ago
  • 2.12.0-canary.11018.6.0                                ...           6 months ago
  • 2.12.0-canary.11015.6.0                                ...           6 months ago
  • 2.12.0-canary.11005.6.0                                ...           6 months ago
  • 2.11.4-canary.11003.6.0                                ...           6 months ago
  • 2.11.4-canary.11002.6.0                                ...           7 months ago
  • 2.11.3-canary.10997.6.0                                ...           7 months ago
  • 2.11.3-canary.10995.6.0                                ...           7 months ago
  • 2.11.3-canary.10981.6.0                                ...           7 months ago
  • 2.11.0                                ...           7 months ago
  • 2.11.0-canary.2fa99416a.0                                ...           7 months ago
  • 2.11.0-canary.10844.6.0                                ...           7 months ago
  • 2.11.0-canary.10836.6.0                                ...           7 months ago
  • 2.11.0-canary.10823.6.0                                ...           7 months ago
  • 2.10.0-canary.10793.6.0                                ...           7 months ago
  • 2.10.0-canary.10787.6.0                                ...           7 months ago
  • 2.10.0-canary.10781.6.0                                ...           7 months ago
  • 2.10.0-canary.10778.6.0                                ...           7 months ago
  • 2.10.0-canary.10759.6.0                                ...           7 months ago
  • 2.10.0-canary.10748.6.0                                ...           7 months ago
  • 2.9.2-canary.10746.6.0                                ...           7 months ago
  • 2.9.1-canary.10740.6.0                                ...           7 months ago
  • 2.9.1-canary.10731.6.0                                ...           7 months ago
  • 2.9.1-canary.10726.6.0                                ...           7 months ago
  • 2.9.0-canary.10710.6.0                                ...           7 months ago
  • 2.9.0-canary.10709.6.0                                ...           7 months ago
  • 2.9.0-canary.10708.6.0                                ...           7 months ago
  • 2.9.0-canary.10705.6.0                                ...           7 months ago
  • 2.9.0-canary.10701.6.0                                ...           7 months ago
  • 2.8.4-canary.bde01a443.0                                ...           7 months ago
  • 2.8.0-canary.33b5593d7.0                                ...           8 months ago
  • 2.7.0                                ...           9 months ago
  • 2.5.1                                ...           a year ago
  • 2.5.0                                ...           a year ago
  • 2.4.0                                ...           a year ago
  • 2.3.1                                ...           a year ago
  • 2.4.0-beta.0                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.3.0-rc.0                                ...           a year ago
  • 2.2.2                                ...           a year ago
  • 2.2.1                                ...           a year ago
  • 2.2.0                                ...           2 years ago
  • 2.2.0-rc.1                                ...           2 years ago
  • 2.1.6                                ...           2 years ago
  • 2.1.5                                ...           2 years ago
  • 2.1.4                                ...           2 years ago
  • 2.1.3                                ...           2 years ago
  • 2.1.2                                ...           2 years ago
  • 2.1.1                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.1.0-beta.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 2.0.0-beta.3                                ...           2 years ago
  • 2.0.0-beta.2                                ...           2 years ago
  • 2.0.0-beta.1                                ...           2 years ago
  • 2.0.0-beta.0                                ...           2 years ago
Downloads
Today 0
This Week 1
This Month 373
Last Day 1
Last Week 0
Last Month 577
Dependencies (7)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |