parnic / go-assetprecompiler Goto Github PK
View Code? Open in Web Editor NEWAsset pipeline/precompiler for Golang
License: MIT License
Asset pipeline/precompiler for Golang
License: MIT License
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!
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?
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/",
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.