Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request further syntax assistance using inliner in a script to parse folders #234

Open
SugarRayLua opened this issue Apr 27, 2024 · 0 comments

Comments

@SugarRayLua
Copy link

Hi and thanks for making the very useful inliner package!

I a mobile programmer and javascript novice and recently began using node.js ported to iOS (iPad):
https://apps.apple.com/us/app/node-js-lab/id1550710789

Unfortunately, it doesn't yet have CLI support. Thus, I need to install npm packages like inliner and
run them via javascript in the app. I modified the example on inliner's github and the script below worked
somewhat (some of my .js and images were inclined) but not all of them:

var Inliner = require('inliner');
const fs = require('fs');

new Inliner('./rpssl/index.html', function (error, html) {
  fs.writeFile("./testIndex.html", html, function(err) {
	  if(err) {
		  return console.log(err);
	  } else {
		  console.log("The file was saved!");
	  }
  });
});

The directory I set up for inliner to parse looks like this:

/ (root)
test.js (containing the script above)
rpssl (dir)
     index.html 
     (multiple).js files
     manifest.json
     icon.png
     sprites (dir-- containing multiple .png sprites)
     fonts (dir -- containing multiple .ttf fonts)

It looks like most who have written in issues have been using the command line so would appreciate any assistance you could provide in terms of how I would set up inliner in the .js script I wrote to be able to parse the different directories to inline their contents into the single file "testIndex.html"

Thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant