goaltools / goal

Goal is a toolkit for high productivity web development in Go language in the spirit of Revel Framework that is built around the concept of code generation.
BSD 2-Clause "Simplified" License
87 stars 3 forks source link

Static file default paths #35

Closed davidhunterxyz closed 8 years ago

davidhunterxyz commented 8 years ago

The default path for static files are at example.com/static/styles/app.css. Maybe it should be at root directory example.com/styles/app.css.

If someone adds a robots.txt file in the static folder it would be at example.com/static/robots.txt. I read that the robots.txt file should be at root example.com/robots.txt

I also think it would be nice to follow twitter bootstrap and html5 boilerplate naming of javascript and css folders. They use /css/main.css and /js/main.js

ghost commented 8 years ago

The default path for static files are at example.com/static/styles/app.css. Maybe it should be at root directory example.com/styles/app.css.

The static prefix is there to avoid collisions of action paths and static file paths. Though, I agree with your argument about robots.txt. How is this implemented in other frameworks?

I also think it would be nice to follow twitter bootstrap and html5 boilerplate naming of javascript and css folders. They use /css/main.css and /js/main.js

It's just a matter of taste isn't it? E.g. semantic-ui uses /javascript and /stylesheets for their site. My own preference is styles, fonts, images, and scripts over css, ???, img, and js because of other directory names that are used for the project. E.g.

In my opinion it would be not consistent to use full names for controllers, models, etc. but shortenings and abbreviations for img, js and so forth.

davidhunterxyz commented 8 years ago

I agree with the naming. I just thought it will be easier for new developers to be able to just copy and paste the files from bootstrap and html5 boilerplate.

With rails they have a folder called public where they put their static files and the route is at root which will work the correct way with a robots.txt file

They use dedicated folders for stylesheets, javascript, and images. Rails automatically creates the links to files in stylesheets and javascript folder. They also have a feature called asset pipeline which merges the stylesheets and javascript files into one file. The route for javascript, stylesheets, and images are at example.com/assets

A feature like Asset Pipeline would be nice for Goal

davidhunterxyz commented 8 years ago

Maybe we can have the static path route to root and add a folder called assets to the static folder and have paths like www.example.com/assets/styles, www.example.com/assets/fonts, www.example.com/assets/images, and www.example.com/assets/scripts. The rest of files in root static folder like a robots.txt will have a path like www.example.com/robots.txt

ghost commented 8 years ago

@DavidHunter Support of a tool for merging static assets is not the highest priority right now (third party ones from JS or Ruby world still can be used). As for the static/assets directory, :+1:. I like this idea.

ghost commented 8 years ago

@DavidHunter Thanks, done.