romanlex / app-manifest-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jantimon/favicons-webpack-plugin
Let webpack generate app manifest, all your favicons and icons for you
License: MIT License
This project forked from jantimon/favicons-webpack-plugin
Let webpack generate app manifest, all your favicons and icons for you
License: MIT License
Hi there,
I'm using this plugin together with HtmlWebpackPlugin and HtmlWebpackTemplate
It works fine while bundling, i.e. generating the folders with the icons and the rest. However when using the dev server such files are emitted but are not created, i.e. when browsing the
http://localhost:<port>/webpack-dev-server
URL I cannot see the folder with the icons listed and when the browser requests, for instance, a favicon, I get a 404:
http://localhost:<port>/icons-<hash>/favicon.ico
response: Cannot GET /icons-1a4ee607/favicon.ico
This is a bit annoying when developing. How can I check if I'm doing something wrong? Or is this just a bug?
Al plugins are latest versions and so is webpack
Configuration
const webpackTemplate = require('html-webpack-template')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const AppManifestWebpackPlugin = require('app-manifest-webpack-plugin')
...
const html = new HtmlWebpackPlugin({
inject: false,
title: globals.title,
template: webpackTemplate,
mobile: true,
appMountId: globals.appMountId,
meta: getMetas(contentSecurityPolicy),
links: getLinks(LINKS),
lang: 'en',
filename: 'index.html',
// favicon: path.join(appDirectory, srcDirectory, 'assets', 'favicons', 'favicon.ico'),
chunks: chunkNames,
scripts: getScripts(SCRIPTS),
window: globalVars
})
const appManifest = new AppManifestWebpackPlugin({
logo: path.resolve(srcDirectory, 'assets', logoFileName),
emitStats: true,
inject: true,
statsFilename: 'iconstats.json',
persistentCache: true,
// Prefix for file names (html will be container icons with this prefix)
prefix: globals.publicPath,
// Output path for icons (icons will be saved to output.path(webpack config) + this key)
output: '/icons-[hash:8]/',
config: {
appName: globals.title, // Your application's name. `string`
appDescription: globals.description, // Your application's description. `string`
developerName: 'Mobile Solutions LINKS Foundation', // Your (or your developer's) name. `string`
developerURL: 'https://linksfoundation.com/en/about/research-areas/', // Your (or your developer's) URL. `string`
background: backgroundColor, // Background colour for flattened icons. `string`
theme_color: chromeThemeColor, // Theme color for browser chrome. `string`
display: 'standalone', // Android display: "browser" or "standalone". `string`
orientation: 'portrait-primary', // Android orientation: "portrait" or "landscape". `string`
start_url: `${globals.publicPath}index.html`, // Android start application's URL. `string`
version: '1.0', // Your application's version number. `number`
logging: true, // Print logs to console? `boolean`
icons: {
// Platform Options:
// - offset - offset in percentage
// - shadow - drop shadow for Android icons, available online only
// - background:
// * false - use default
// * true - force use default, e.g. set background for Android icons
// * color - set background for the specified icons
//
android: true, // Create Android homescreen icon. `boolean` or `{ offset, background, shadow }`
appleIcon: true, // Create Apple touch icons. `boolean` or `{ offset, background }`
appleStartup: true, // Create Apple startup images. `boolean` or `{ offset, background }`
coast: false, // Create Opera Coast icon with offset 25%. `boolean` or `{ offset, background }`
favicons: true, // Create regular favicons. `boolean`
firefox: true, // Create Firefox OS icons. `boolean` or `{ offset, background }`
windows: true, // Create Windows 8 tile icons. `boolean` or `{ background }`
yandex: false // Create Yandex browser icon. `boolean` or `{ background }`
}
}
})
const plugins = [html, appManifest ...]
globals.publicPath
is '/' in dev-server mode in my setup.
Hi,
Whenever I set android to be false in the config part, it does not generate a manifest.json file.
Is this the correct behaviour or am I just missing something?
Here is my set up:
new AppManifestWebpackPlugin({
logo: "./public/assets/icon.png",
inject: true,
prefix: "/ClientApp/dist/assets",
output: "assets/",
config: {
appName: "{REDACTED}",
appShortName: "{REDACTED}",
developerName: "Josh Asi",
background: "#fff",
theme_color: "#0000fd",
display: "standalone",
orientation: "landscape",
scope: "/",
start_url: "../",
version: "1.0",
logging: false,
icons: {
**android: false,**
appleIcon: true,
appleStartup: true,
coast: false,
favicons: true,
firefox: true,
windows: true,
yandex: false
}
}
})
The current version of app-manifest-webpack-plugin
isn't compatible with html-webpack-plugin
v4. The following error is thrown:
compilation.hooks.htmlWebpackPluginAfterHtmlProcessing is lost.
Please make sure you have installed html-webpack-plugin and put it before AppManifestWebpackPlugin
The fix for preload-webpack-plugin
was fairly simple, so I guess it could be applied to this plugin as well (see https://github.com/GoogleChromeLabs/preload-webpack-plugin/pull/81/files).
Although html-webpack-plugin is still in alpha, it is used by create-react-app, so it is already widely used.
The manifest is never generated with crossorigin="use-credentials"
thus will always get 401 error = doesn't work on any site requiring basic HTTP authentication. As far as I see there is no way to configure this package to produce the required property to avoid this fatal error.
Hi,
I have two HtmlWebpackPlugin instances, to generate two separate indexes.
Is there a way to associate one App Manifest plugin to one of them and another one to the other?
Thank you
When using an output path, the manifest.json and other generated, non-image, files are saved in the same directory. The should default to the root directory of the application.
Hello!
I'd like to say thanks for this plugin!
Can you make webpack 5 support or you don't have time to maintain this repo anymore?
Cheers,
A manifest.json file is injected into the HTML file, but it doesn't appear to be created. Is there any option I'm currently missing?
It is due to a couple of code snippets as follow:
const webpackConfig = {
plugins: [
new ScriptExtHtmlWebpackPlugin({
inline: /manifest/
}),
new AppManifestWebpackPlugin({
logo: 'my-logo.png'
})
]
}
In the configuration object, what's appName
exactly? Will it become name
and short_name
in the manifest?
Also, is there a chance to add scope
as part of the configuration? I think it's the only setting not present that is necessary for a Progressive Web App manifest.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.