1.0.7 ā€¢ Published 6 years ago

linee v1.0.7

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

LINEE

Build Status Coverage Status Maintainability JavaScript Style Guide

Micro component definition.

Install

$ npm install linee

Component Structure

šŸ“‚ comp
ā”œā”€ā”€ā”€ šŸ“„ comp.export.js
ā”œā”€ā”€ā”€ šŸ“„ comp.render.js
ā”œā”€ā”€ā”€ šŸ“„ comp.script.js
ā”œā”€ā”€ā”€ šŸ“„ comp.css
ā””ā”€ā”€ā”€ šŸ“„ comp.spec.js

šŸ“„ component.export.js

Export the component files.

const ln = require('linee')

module.exports = ln.getComponent({
  render: './comp/comp.render',
  style: './comp/comp.css'
})

šŸ“„ component.render.js

Define the component markup.

const render = name => `
  <h1 class='comp'> ${name} </h1>
`

module.exports = render

šŸ“„ component.script.js

Define the component behavior.

const $ = require('jquery-slim')

$('.comp').on('click', e => {
    console.log('my first component!')
})

šŸ“„ component.css

/*==========================================================================
  comp
  ==========================================================================*/

.comp{
  color: white;
  background: black
}

Usage

šŸ“„ app.js

const comp = require('./components/comp.export.js')

comp('first')
comp('second')

šŸ‘‡

/*
<style>
.comp{
  color: white;
  background: black
}
</style>
<h1 class='comp'> first </h1>
<h1 class='comp'> second </h1>
*/

API

getComponent({renderPath, stylePath}) āŸ¶ string

get and format a component.

const ln = require('linee')

ln.getComponent({
  render: './comp/comp.render',
  style: './comp/comp.css'
})

// get a component with multiple styles

ln.getComponent({
  render: './comp/comp.render',
  style: [
    './comp/comp1.css',
    './comp/comp2.css',
    './comp/comp3.css'
  ]
})

getStyle(path || [path]) āŸ¶ string

get and formats style files to work inline.

const ln = require('linee')

ln.getStyle('./com/comp.css')

//get multiple style files.

ln.getStyle([
  './com/comp1.css',
  './com/comp2.css',
  './com/comp3.css'
])

getScript(path || [path]) āŸ¶ string

get and formats style files to work inline.

const ln = require('linee')

ln.getScript('./com/comp.script.js')

//get multiple script files.

ln.getScript([
  './com/comp1.script.js',
  './com/comp2.script.js',
  './com/comp3.script.js'
])

minHTML(code) āŸ¶ string

minify html code.

const ln = require('linee')

ln.minHTML('<h1> Hello, world! </h1>')

Licensed under the ISC License 2018 - C4co

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.0

6 years ago