Skip to content

Instantly share code, notes, and snippets.

@whs
Last active December 2, 2019 01:21
Show Gist options
  • Select an option

  • Save whs/5139150212a42ac3f785491126d256cd to your computer and use it in GitHub Desktop.

Select an option

Save whs/5139150212a42ac3f785491126d256cd to your computer and use it in GitHub Desktop.
const fs = require('fs')
const yaml = require('js-yaml')
module.exports = function(content) {
// Load ไฟล์ภาษา
const content = content || fs.readFileSync(this.resourcePath)
let lang = yaml.safeLoad(content, {
schema: yaml.FAILSAFE_SCHEMA,
})
const string = lang[this.resourceQuery]
return `export default ${JSON.stringify(string)}`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment