Git Product home page Git Product logo

grunt-lisp.js's Introduction

grunt-lisp.js

Transpile lisp to JS with Grunt

Getting Started

Read the Grunt getting started guide. Add the dependecy to your package.json:

"devDependencies": {
  "@javanut13/grunt-lisp.js": "0.0.3",
  "grunt": "^0.4.5"
}

Add the task config in your Gruntfile:

lisp_js: {
  options: {
    extension: 'lsp',
    cut: 'src/',
    extend: require('./test/extend')
  },
  src: [
    'src/**/*.lsp'
  ],
  dest: 'build/'
},
...
grunt.loadNpmTasks('@javanut13/grunt-lisp.js');

All the files in the src will be transpiled and output to the dest folder in the same structure as the input. If the exension of the file matches the extension option it will be removed from the filename before adding .js. The cut option lets you remove a part of the path when outputting to the destination.

The Lisp.js generator can be extended with custom functions. A function should be passed in that will be used to add definitions to the language. These can obviously be in a separate file and require-ed. For example:

module.exports = function(lisp) {
  lisp.extend('not', function(items) {
    return '(!' + this.get(items[0]) + ')';
  });
}

Watch

You can use watch to run Lisp.js whenever you edit a lisp file:

watch: {
  scripts: {
    files: ['src/**/*.lsp'],
    tasks: ['lisp_js'],
    options: {
      spawn: false,
    },
  },
}
...
grunt.loadNpmTasks('grunt-contrib-watch');

Then run grunt watch and nodemon build/server.js (nodemon) to auto-restart the server when the files are transpiled.

grunt-lisp.js's People

Contributors

willhbr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.