ed-lansawebpack-plugin

Lansa repository Loader/Compiler for WebPack/Vue (Emmedata Srl)

Usage no npm install needed!

<script type="module">
  import edLansawebpackPlugin from 'https://cdn.skypack.dev/ed-lansawebpack-plugin';
</script>

README

ed-lansawebpack-plugin

Resolve LANSA repository field, mtxtvars and messages definitions and create a repository object to use in Vue projects.

Installation

  1. Add ed-lansawebpack-plugin to your project
$ npm install --save-dev ed-lansawebpack-plugin
  1. Add the plugin in vue.config.js
const LansaWebPackPlugin = require('ed-lansawebpack-plugin')
module.exports = {
    chainWebpack: config => {
        config.module
            .rule('vue-repo')
            .test(/\.vue$/)
            .exclude
                .add(/node_modules/)
                .end()            
            .use('ed-lansawebpack-plugin')
                .loader('ed-lansawebpack-plugin')
                .end();

        config.module
            .rule('js-repo')
            .test(/\.js$/)
            .exclude
                .add(/node_modules/)
                .end()            
            .use('ed-lansawebpack-plugin')
                .loader('ed-lansawebpack-plugin')
                .end();  
        
        config
            .plugin('LansaWebPackPlugin.compiler')
                .use(LansaWebPackPlugin.compiler, [{
                    devserver: {
                        host: 'localhost',
                        port: '8000',
                        path: '/lansa/getrepository'
                    }}])
                .end();        
}
  1. Add repository reference in main.js
import repository from '../lansa/repository';

Warning! the code MUST be inserted immediatly after

import app from './app.vue';

Usage

In .vue or .js sources the plugin will search for theese tags references:

  • v-ed-format directive
  • p-lansa-field attribute
  • $lansa.text function
  • __LANSA__ template function (use when needs to decode LANSA repository objects in other parts of the program)
function __LANSA__(t) {return t;}

License

ed-lansawebpack-plugin may be redistributed according to the BSD 3-Clause License.

Copyright 2020