Closed 262925 closed 4 years ago
I'm not sure what you have tried, but try this:
npx webpack --mode=development
or just npx webpack
to build the assetspublic/assets/
directory<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base href="{{ base_path() }}/"/>
Just creating own simple cms to learn. Thank you so much for your skeleton which great start-up for new Slim learners. I already did mentioned things. Console return 404 errors.
Looks good, so far. Try to find the "correct" url for the main.js/main.css files manually.
Actually same working on Hosting server but in the localhost. Any idea for it.?
Sounds like an typical basePath issue if you run Slim in an sub-directory (applies for most development environments). Please give me more details (error message & code, screenshot, directory, etc...).
Running directory is c/wamp/www/dts(simple cms). I used your skeleton nothing else. I added some screenshot here. please let me know if you need anything else. Thank you.
Container:
Middleware
Error:
Composer.json
Your app is running in a sub-directory (under c/wamp/www/dts). So the BasePathMiddleware should set Slims basePath to /dts
automatically for you.
What is the output of the Twig helper function base_path()
?
in your layout/layout.wig file here:
<base href="{{ base_path() }}/"/>
On your localhost the output should be: <base href="dts/"/>
On your prod server the output should be: <base href="/"/>
Is your host root pointed to the public directory inside dts?
What is the output of the Twig helper function
base_path()
?
@odan Return <base href="/"/>
- where do i change that?
Is your host root pointed to the public directory inside dts?
@dunkoh i think yes. C:\wamp\www\dts>php -S localhost:8080 -t public public/index.php
Good hint from @dunkoh. I thought you were using Apache. If you use the PHP internal web server, you can try this command:
cd c:\wamp\www\dts
php -S localhost:8080 -t public
Then navigate to: http://localhost:8080/
The base href should then look like this: <base href="/"/>
@odan Which is works cool!. Thank you.
I did followed your tutorial twig-webpack-extension-setup with this skeleton which getting error 404. Do you have any idea what cause the problem?