Where to put favicon, other root assets?
Closed this issue ยท 7 comments
The simplest method of including favicon.ico
is in the root directory, which also avoids any 404 requests in the browser. Many static generators have an htdocs
or static
directory for assets that should be copied over verbatim. It would be nice to not have to specify <link>
elements for this info.
Perhaps we should include these by default:
assets/static/favicon.ico
- the
assets
task, configured to copyassets/static/**/*
todist
No one seems to feel strongly about where this lives. If this gets too big, this doesn't necessarily need to make it into 1.0
Okay, I think I finally have an opinion on this. I wanted to share my "plan of attack" with @erikjung and @mrgerardorodriguez first before proceeding.
Directory Structure
I'm going to set aside for a moment the question of "is assets/
the right place for styles, scripts and/or images we plan on processing or compiling in some way?" That's a decent question, and I have opinions about it, but I realized it was getting in my way in terms of actually getting things done, so we should open a separate issue for discussion if we want to tackle that.
But in a perfect world, where would the static assets live?
For me, that's easy: ./src/static
. It's simple. It's descriptive. It's pretty common. And unlike "assets," I feel like it implies that no processing will occur on those items. The definition of "static" is "lacking in movement, action or change." It's perfect.
I don't think it should live higher up in the structure than ./src
. To me, ./src
should really be where I live as a designer-developer. I want those files in there.
Gulp task
As noted in cloudfour/core-gulp-tasks#26, the "assets" task is kind of a mess. To recap:
- We have a directory called
./src/assets
that, by default, contains only CSS and JavaScript. - We have a task called
assets
that does not do anything with CSS or JavaScript. - Said task includes
imagemin
, which is the largest dependency in the whole project. - We do not currently use the image optimization in any of our projects.
I would like to replace that task with a task called static
. It'll copy files from one directory to another directory. That's it.
If we ever want an image-processing task again, we should give it a name like images
to match our css
and js
tasks.
Plan of Attack
If all of that sounds good, the next steps would be to...
- cloudfour/core-gulp-tasks#26
- Rename
assets
task tostatic
- Remove image optimization stuff, including
package.json
dependencies - Update tests
- Bump package version
- Rename
- #33 #40
- Update
core-gulp-tasks
dependency - Add
src/static/favicon.ico
(good temp icon here) - Register and configure
static
task by default
- Update
But first...
Does all of that make sense?
Works for me! ๐
Can we just call the task copy
instead of static
since it could in theory be used on any directory?
Otherwise, ๐
Can we just call the task
copy
instead of static since it could in theory be used on any directory?
Sure, totally fine by me.