Lidingo Customisation
Custom CSS/JS overrides for Municipio using Vite.
by Consid Webbteamet · github.com/consid-webbteamet/lidingo-customisation
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/consid-webbteamet/lidingo-customisation/archive/refs/heads/main.zipReadme
Lidingo Customisation
WordPress-plugin for CSS/JS overrides in Municipio. Assets are built with Vite and loaded after Municipio custom code output.
Development
npm install
npm run dev
npm run build
composer dump-autoload
Behavior
- Frontend CSS output:
wp_headpriority1001 - Frontend JS output:
wp_footerpriority1001withdefer - Vite dev server is used automatically in
WP_ENV=developmentwhen reachable - Dev-only CSP domains are appended through
WpSecurity/Cspfor:script-src:localhost:5173style-src:localhost:5173connect-src:localhost:5173andws://localhost:5173
- Dev HTTP-mode CSP override removes
upgrade-insecure-requestsandblock-all-mixed-contentwhen:- Vite dev server is active, or
- local development runs in
WP_ENV=developmentwithhome_url()onhttp://
Website/HTML/outputCSP hook is intentionally argumentless because earlier callbacks in the filter chain may returnnull- Admin assets are disabled by default and can be enabled with filter:
add_filter('lidingo_customisation/should_load_admin', '__return_true');
Filters
lidingo_customisation/should_load_frontend(defaulttrue)lidingo_customisation/should_load_admin(defaultfalse)lidingo_customisation/article_post_types(defaultpost,news,nyheter+ all public post types with archives)- Use this to add or trim singular post types that should use the shared article layout.
add_filter('lidingo_customisation/article_post_types', function (array $postTypes): array {
$postTypes[] = 'pressrelease';
return array_values(array_unique($postTypes));
});
Workflow
- Write new CSS/JS in this plugin repository.
- Start Vite with
npm run dev(default:http://localhost:5173). - Open the WordPress site over HTTP in local development (
http://municipio-deployment.test). - If the site is opened over HTTPS while Vite runs over HTTP, the browser may block assets (mixed content).
- Build with Vite for release/deploy.
- Keep Municipio theme custom CSS/JS unchanged.
Local HTTP mode
- Local development is expected to run in HTTP mode end-to-end.
- Keep the site URL as
http://municipio-deployment.testwhen using Vite onhttp://localhost:5173. - If
force-sslis network-activated locally, disable it locally so WordPress does not rewrite theme/plugin assets tohttps://while browsing overhttp://. - In local HTTP development mode (
WP_ENV=development+home_url()withhttp://), this plugin strips CSP directivesupgrade-insecure-requestsandblock-all-mixed-contenteven when Vite dev server is off.
Dev vs build
npm run dev:- serves assets from Vite dev server
- injects
@vite/clientand enables HMR - requires local CORS/CSP setup (already handled in this plugin)
npm run build:- writes production assets to
dist/ - does not use the Vite dev server
- is used by deployment/build pipelines
- writes production assets to
- When the dev server is not reachable, the plugin falls back to
dist/assets.
Push and deploy flow
- Work in this repository:
/Users/jonasnasman/municipio-plugins/lidingo-customisation. - Commit and push to
Consid-Webbteamet/lidingo-customisation(devbranch). - In the WordPress deployment repository, run:
composer update consid-webbteamet/lidingo-customisation
- Commit updated
composer.lockin the deployment repository. - Production deploy runs
composer install, which installs the exact commit reference fromcomposer.lock.
Build artifacts
dist/is gitignored in this repository and should not be committed here.- Deployment packaging is expected to run root
build.php, which runs child pluginbuild.phpand buildsdist/during CI/CD.