All Projects → rse → node-inline-assets

rse / node-inline-assets

Licence: other
Node API, CLI and Grunt Task for inlining external assets of HTML/CSS files

Programming Languages

javascript
184084 projects - #8 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to node-inline-assets

AssetLens
Asset Lens : Unity asset reference management utility working in background. 에디터 백그라운드에서 관리되는 유니티 에셋 파일 레퍼런스 데이터 도구.
Stars: ✭ 47 (+161.11%)
Mutual labels:  asset
exe2hex
Inline file transfer using in-built Windows tools (DEBUG.exe or PowerShell).
Stars: ✭ 284 (+1477.78%)
Mutual labels:  inline
v-img
📸Use webp and lazyload images
Stars: ✭ 48 (+166.67%)
Mutual labels:  img
phaser-manifest-loader
Phaser Manifest Loader
Stars: ✭ 28 (+55.56%)
Mutual labels:  asset
atom-inline-blame
Atom package to display blame inline
Stars: ✭ 23 (+27.78%)
Mutual labels:  inline
pegnet
pegnet.org
Stars: ✭ 41 (+127.78%)
Mutual labels:  asset
React Svg Inline
DEPRECATED, I recommend you the tool SVGR
Stars: ✭ 230 (+1177.78%)
Mutual labels:  inline
UnityBuildManager
Utility for running builds sequence & pushing them to markets & keeping changelog
Stars: ✭ 53 (+194.44%)
Mutual labels:  asset
InlineCssParser
A Visual Studio Extension that helps to extract inline styles into a seperate css file.
Stars: ✭ 23 (+27.78%)
Mutual labels:  inline
img2Ascii
基于JS的图片转ASCII码示意图
Stars: ✭ 18 (+0%)
Mutual labels:  img
react-cryptocoins
Сryptocurrencies icons as React components
Stars: ✭ 37 (+105.56%)
Mutual labels:  inline
ImgConverter
🏷 ImgConverter is chrome extension that converts form image of markdown notation to img tag(<img>) when you upload images
Stars: ✭ 18 (+0%)
Mutual labels:  img
js.metaret
lightweight mutual tail recursion optimization without trampoline
Stars: ✭ 16 (-11.11%)
Mutual labels:  inline
flutter resource generator
Generate an R file for mapping all assets. Supports preview of image.
Stars: ✭ 69 (+283.33%)
Mutual labels:  asset
asm-inline
Inline raw ASM instructions in Java
Stars: ✭ 23 (+27.78%)
Mutual labels:  inline
Inline syscall
Inline syscalls made easy for windows on clang
Stars: ✭ 232 (+1188.89%)
Mutual labels:  inline
vue-svg-inline-plugin
Vue plugin for inline replacement of SVG images with actual content of SVG files.
Stars: ✭ 30 (+66.67%)
Mutual labels:  inline
nova-inline-morph-to
A Laravel Nova field for displaying morphTo relationship inline.
Stars: ✭ 32 (+77.78%)
Mutual labels:  inline
Inlin-Craft
Plugin for inlining files in templates.
Stars: ✭ 64 (+255.56%)
Mutual labels:  inline
USERGE-X
USERGE-X. What the X ?
Stars: ✭ 133 (+638.89%)
Mutual labels:  inline

Node-Inline-Assets

Node API, CLI and Grunt Task for inlining external assets of HTML/CSS files.

Abstract

This is a Node Application Programming Interface (API), Command-Line Interface (CLI) and Grunt Task for inlining all external assets of HTML/CSS files. The purpose of this approach is to either reduce the number of required HTTP requests for HTML5 Single-Page-Apps (SPA) or to simply bundle a stand-alone HTML document with all its external assets for easier distribution.

Installation

Use the Node Package Manager (NPM) to install this module locally (default) or globally (with option -g):

$ npm install [-g] inline-assets

Usage

Command-Line Interface (CLI)

$ inline-assets \
  [--verbose] \
  [--htmlmin] [--cssmin] [--jsmin] \
  [--pattern <filename-regex>] \
  [--purge] \
  <source-file> [<destination-file>]

Grunt Build Process

grunt.initConfig({
    "inline-assets": {
        options: {
            verbose: false,
            htmlmin: false,
            cssmin:  false,
            jsmin:   false,
            pattern: [ ".+" ],
            purge:   false
        },
        "example": {
            src:  "<source-file>",
            dest: "<destination-file>"
        },
        [...]
    },
    [...]
})

Application Programming Interface (API)

var fs = require("fs")
var inlineAssets = require("inline-assets")
var content = fs.readFileSync("<source-file>", "utf8")
content = inlineAssets("<destination-file>", "<source-file>", content, {
    verbose: false,
    htmlmin: false,
    cssmin:  false,
    jsmin:   false,
    pattern: [ ".+" ],
    purge:   false
})
fs.writeFileSync("<destination-file>", content, "utf8")

Options

The processing options are:

  • verbose: Print verbose processing information.
  • htmlmin: Minify processed HTML content (with html-minifier).
  • cssmin: Minify processed CSS content (with csso).
  • jsmin: Minify processed JavaScript content (with uglify-js).
  • pattern: Comma-separated list of positive/negative filename regex patterns.
  • purge: Purge HTML/CSS/JavaScript references of files excluded by pattern.

License

Copyright (c) 2014-2021 Dr. Ralf S. Engelschall (http://engelschall.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].