Reputation: 1929
I'm trying to create an executable
in my node.js project with pkg
and I can create this but without css files.
So, I install pkg
with npm install -g pkg
, in package.json
I add this:
"pkg": {
"scripts": "public/js/*.js",
"assets": "public/css/*.css",
"assets": "views/**/*"
},
It adds the js.files fine and recognizes views, except css file.
My project structure is that:
In console, I ran the command pkg .
and it generates linux, macos and win executables.
How can I add my css file and image folder too?
Upvotes: 1
Views: 16195
Reputation: 11
in package.json file add like this
"pkg": {
"assets": [
"views/*",
"Public/**/*"
],
...
}
put all you images, js, css etc into Public folder
Upvotes: 1
Reputation: 2289
One solution is to have pkg
detect assets in the source code rather than using a config object at the package.json
level.
This is documented here. Basically, if you add the line path.join(__dirname, '../path/to/asset.css');
to your source code pkg
should automatically add it to the executable.
Upvotes: 0