malta-header-comment

Malta plugin to add a header comment

Usage no npm install needed!

<script type="module">
  import maltaHeaderComment from 'https://cdn.skypack.dev/malta-header-comment';
</script>

README


npm version"> npm downloads npm downloads

This plugin can be used on: .html, .xml, .svg, .js, .css, .less, .scss, .php, .java, .ts

Options :
- name : path of the file containing the text that must be prepended, the path is relative to the execution folder
- nostrict : by default 'no strict'; is added at the top of the script; in case is not desired this is an optional parameter to skip it, the value passed is not relevant

In the header file it is possible to use the __SIZE__ placeholder, il will be replaced with "~nKB" where n is the size of the output file.

Sample usage:

malta app/source/style.css public/css -plugins=malta-css-uglify...malta-header-comment[name:\"licence.txt\",nostrict:true]

or in the .json file :

"app/source/style.css" : "public/css -plugins=malta-css-uglify...malta-header-comment[name:\"licence.txt\"]"

or in a script :

var Malta = require('malta');
Malta.get().check([
    'app/source/style.css',
    'public/css',
    '-plugins=malta-css-uglify...malta-header-comment[name:\"licence.txt\"]',
    '-options=showPath:false,watchInterval:500,verbose:0'
    ]).start(function (o) {
        var s = this;
        console.log('name : ' + o.name)
        console.log("content : \n" + o.content);
        'plugin' in o && console.log("plugin : " + o.plugin);
        console.log('=========');
    });