GithubHelp home page GithubHelp logo

Twig assets about slim4-skeleton HOT 12 CLOSED

odan avatar odan commented on May 18, 2024
Twig assets

from slim4-skeleton.

Comments (12)

dunkoh avatar dunkoh commented on May 18, 2024 1

Is your host root pointed to the public directory inside dts?

from slim4-skeleton.

odan avatar odan commented on May 18, 2024 1

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="/"/>

from slim4-skeleton.

odan avatar odan commented on May 18, 2024

I'm not sure what you have tried, but try this:

  • Run: npx webpack --mode=development or just npx webpack to build the assets
  • Then check if the files exists in the public/assets/ directory
  • If you run your site / app in a sub-directory, make sure you set the correct base href of the html document, e.g.
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <base href="{{ base_path() }}/"/>
  • Show me the F12 developer toolbar request and response.

from slim4-skeleton.

262925 avatar 262925 commented on May 18, 2024

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.
image

image

image

from slim4-skeleton.

odan avatar odan commented on May 18, 2024

Looks good, so far. Try to find the "correct" url for the main.js/main.css files manually.

from slim4-skeleton.

262925 avatar 262925 commented on May 18, 2024

Actually same working on Hosting server but in the localhost. Any idea for it.?

from slim4-skeleton.

odan avatar odan commented on May 18, 2024

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...).

from slim4-skeleton.

262925 avatar 262925 commented on May 18, 2024

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:
image
image

Middleware
image

Error:
image

Composer.json
image

from slim4-skeleton.

odan avatar odan commented on May 18, 2024

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="/"/>

from slim4-skeleton.

262925 avatar 262925 commented on May 18, 2024

What is the output of the Twig helper function base_path() ?

@odan Return <base href="/"/> - where do i change that?

from slim4-skeleton.

262925 avatar 262925 commented on May 18, 2024

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

from slim4-skeleton.

262925 avatar 262925 commented on May 18, 2024

@odan Which is works cool!. Thank you.

from slim4-skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.