Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Merge requests
  • !295

Add global macros array for node loader.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/Paxa/master into master Apr 05, 2014
  • Overview 9
  • Commits 1
  • Pipelines 0
  • Changes 3

Created by: Paxa

For my opened issue #294 (closed):

sweet.loadedMacros - array of macros used with node-loader. sweet.loadMacro(file) - helper to load macros. Same as sweet.loadedMacros.push(sweet.loadNodeModule(process.cwd(), './macros/str'))

Example:

var sweet = require('sweet.js');
sweet.loadMacro('./macros/str');
require('./test.sjs');

Note: it doesn't work if we load macros inside executing file and use in same file

sweet.loadMacro('./macros/puts');
puts 123; // not working
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/Paxa/master