Giter Club home page Giter Club logo

go-assetprecompiler's People

Contributors

dependabot[bot] avatar jimafisk avatar parnic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-assetprecompiler's Issues

Permissions when creating output folder

Thanks for sharing this project @parnic, it seems to be exactly what I'm looking for! I have a simple setup in my func main() that looks like this:

precompiler.Compile(precompiler.Config{
  Files: []string{
    "assets/css/main.css",
    "assets/css/components/nav.css",
  },
  Minify:    true,
  OutputDir: "assets/public/",
})

When I run go run . to compile my project and start up the webserver, if the folder doesn't exist previously, it creates a new folder at assets/public/. However this directory has no permissions on it so it loses the ability to create the assets/public/css subfolder. If I manually run chmod -R 777 assets/public/ and then do go run . again, this time it's able to create the assets/public/css subfolder, but the new folder is also not given any permissions so it's unable to create the css file. If I manually change permissions on this folder via chmod -R 777 assets/public/css/ and run go run . one more time, it now creates a file that looks something like app-4b19fcc789a5a38eff577d18f2f343aee38dbc3ea4e040cd665d27f9bbc29869.min.css.

Is there something I should be doing in my Go project setup to fix this permissions issue, or do I need to manually update directory permissions like I did above? Thanks!

Referencing fingerprinted assets in template

In the README.md it mentions you can:

create a template function to retrieve the correct filenames so you don't have to update your template every time you re-generate.

Is there an example of how to do this and reference that file name hash in a template?

Wildcard in file path

Is it possible to reference all files in a given folder using a wildcard, something like an asterisk (*)?

For example if I had many "component" css files in a directory, could I just point to the directory instead of each file individually? Given a tree structure like this:

|--assets/
|----css/
|----main.css
|----components/
|------slider.css
|------grid.css
|------button.css
|------tabs.css
|----public/
|------css/

Concatenate slider.css, grid.css, button.css, and tabs.css with this code:

precompiler.Compile(precompiler.Config{
  Files: []string{
    "assets/css/main.css",
    "assets/css/components/*.css",
  },
  Minify:    true,
  OutputDir: "assets/public/",
})

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.