Sign in
Log inSign up
How to use npm modules in a (npm) build script?

How to use npm modules in a (npm) build script?

Deactivated User's photo
Deactivated User
·Feb 9, 2016

I've used build tools in a fairly basic way for some time now. But I'm stuck when going more advanced. E.g. I'd like to use the inline-css module, but I see only an example when using in node, not command use in a node build.

My current build script (compile emailing html):

{
  "name": "YourGuide",
  "version": "0.1.0",
  "author": "Jos Faber",
  "devDependencies": {
    "concat": "latest",
    "replace": "latest",
    "inline-css": "latest"
  },
  "scripts": {
    "clean": "rm -rf dist",
    "mkdist": "mkdir -p dist",
    "copy": "cp src/*.html dist/",
    "inline": " --- how to use inline-css here? ---",
    "fix": "npm run fix_cdn && npm run fix_img",
      "fix_cdn": "replace '<h3>(EV|UPC)([0-9])TITLE</h3>[.]*<h4>(EV|UPC)[0-9]DATE</h4>[.]*<h5>(EV|UPC)[0-9]INFO</h5>' '*|$1$2INFO|*' dist/*.html",
      "fix_img": "replace 'img/' 'cdn.domain.com/yourguide/' dist/*.html",
    "dist": "npm run clean && npm run mkdist && npm run copy && npm run inline && npm run fix"
  },
  "dependencies": {
    "concat": "^1.0.0",
    "inline-css": "^2.1.1",
    "replace": "^0.3.0"
  }
}

Any ideas? Thanks in advance!