Coder Social home page Coder Social logo

generate-ol-template's Introduction

generate-ol-template

Generate .OL-template files from .html files. This script can handle local and remote resources (javascript, CSS, images).

Usage:

const generateOLTemplate = require('generate-ol-template')

const input  = '/path/to/index.html'

/*
 * All local resources (js, css, ...) are resolved relative to the HTML
 * directory and embeded in the template.
 *
 * All remote resources are configured in the template.
 */

const output = './build.OL-template'

/*
 * The output file will be written to './build.OL-template'
 */

generateOLTemplate(input, output)
  .then(() => console.log('Done.'))
  .catch(err => console.log('Error', err))

Install

npm install -g https://github.com/romgrk/generate-ol-template

Command line tool

generate-ol-template ./path/to/index.html [./path/to/build.OL-template]

Will generate the template at ./path/to/build.OL-template, or ./index.OL-template if no second parameter is given.

Connect Scripts

It is possible to write Connect Designer scripts directly in the HTML file and have them in the generated template. To do so, place a script in the <head> with type application/connect.

E.g.:

<script type="application/connect" name="Insert data" selectorType="QUERY" selectorText="head">
  var html = [
    '<script>'
  , 'window.SERVER_URL = '  + JSON.stringify(record.fields.url)
  , 'window.SERVER_DATA = ' + record.fields.data
  , '</' + 'script>'
  ].join('\n');
  results.append(html);
</script>
HTML attribute description type
name Script name string
control Is a control script? true or false
enabled Is enabled? true or false
selectorType Selector type QUERY or TEXT or QUERY_AND_TEXT
selectorText Selector text (if applicable) e.g .table-blue
findText Text to replace (if applicable) e.g @email@

Metas

<meta name="..."> and <meta http-equiv="..."> tags are also extracted from the html and configured in the resulting template. (Those are the only two meta tags supported by Designer)

generate-ol-template's People

Contributors

romgrk avatar

Watchers

James Cloos avatar  avatar  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.