Git Product home page Git Product logo

go-staticfiles's People

Contributors

catcombo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

davidonium

go-staticfiles's Issues

Problems on Windows

This project is wonderful and it's something I would have done - sooner or later. So thank you again.

I'm trying to use it but I have some doubts.

REPRODUCTION

You can find a reproduction of my project here: https://github.com/frederikhors/test_go_staticfiles

I'm using the amazing quicktemplate but you can try it with go templates too.

You can find a Readme.md in the project.

The branch master is without go-staticfiles, my doubts are in branch staticfiles.

You have a comparison here: https://github.com/frederikhors/test_go_staticfiles/compare/staticfiles?expand=1.

THE PROBLEM

If I follow your usage instructions I change my code from this:

<link rel="stylesheet" href="/static/css/base.css"/>

to this:

<link rel="stylesheet" href="{%s StaticFilesPrefix + Storage.Resolve("css/base.css") %}"/>

but the result is:

<link rel="stylesheet" href="/static/"/>

instead of what I expect:

<link rel="stylesheet" href="/static/css/base.934823cbc67ccf0d67aa2a2eeb798f12.css"/>

WHAT I TRIED

I understand this is a problem with the generated .json manifest you create.

I need to use this:

<link rel="stylesheet" href="{%s StaticFilesPrefix + Storage.Resolve("web\\static\\css\\base.css") %}"/>

to get something from Storage.Resolve().

I think because the content of .json manifest is:

{"paths":{"web\\static\\css\\base.css":"web\\public\\web\\static\\css\\base.934823cbc67ccf0d67aa2a2eeb798f12.css"},"version":1}

Now the final html is:

<link rel="stylesheet" href="/static/web\public\web\static\css\base.934823cbc67ccf0d67aa2a2eeb798f12.css"/>

which is wrong again because my server is serving files from web/public/web/static folder (and this is ugly itself) but on path http://localhost:3000/static without the need for useless web\public\web\static\.

ANOTHER QUESTION

And why the backslashes?


Maybe a problem or maybe it's me.

Thanks again.

Environment variable to enable/disable.

I think we can add an env var to enable/disable staticfiles.

Particularly useful for development vs production.

Something like: STATIC_FILES_ENABLED=true/false.

What do you think?

A very long hash

It would be amazing to change from this one:

favicon.01998662be09f970ca7aa8193a7a460c.ico

to:

favicon.8376ac71.ico

I think we do not need this very long hash. What do you think?

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.