boxwood 0.61.5 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ const { join } = require('path')
2
+ const { readFileSync } = require('fs')
1
3
  const csstree = require('css-tree')
2
4
  const toHash = require('string-hash')
3
5
 
@@ -258,6 +260,12 @@ function css(inputs) {
258
260
  }
259
261
  }
260
262
 
263
+ css.load = function () {
264
+ const path = join(...arguments)
265
+ const content = readFileSync(path, 'utf8')
266
+ return css`${content}`
267
+ }
268
+
261
269
  function js(inputs) {
262
270
  let result = ''
263
271
  for (let i = 0, ilen = inputs.length; i < ilen; i += 1) {
@@ -274,6 +282,12 @@ function js(inputs) {
274
282
  }
275
283
  }
276
284
 
285
+ js.load = function () {
286
+ const path = join(...arguments)
287
+ const content = readFileSync(path, 'utf8')
288
+ return js`${content}`
289
+ }
290
+
277
291
  const node = (name) => (options, children) => tag(name, options, children)
278
292
  const doctype = node('!DOCTYPE html')
279
293
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boxwood",
3
- "version": "0.61.5",
3
+ "version": "0.62.0",
4
4
  "description": "Compile HTML templates into JS",
5
5
  "main": "index.js",
6
6
  "scripts": {