Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts and Images #194

Open
tommykent1210 opened this issue Aug 20, 2013 · 13 comments
Open

Fonts and Images #194

tommykent1210 opened this issue Aug 20, 2013 · 13 comments

Comments

@tommykent1210
Copy link

I don't know if this has bee answered before, but is there any way to make Basset handle fonts too?

The issue is, I use Fontawesome and Laravel. Basset obviously compiles all CSS to the builds folder in one nice css file. However, Fontawesome's Font files are in /components/fontawesome/font and the fontawesome css file references them relatively (via:
src: url('../font/fontawesome-webfont.eot?v=3.2.1'); )

This presents a problem, because the fonts aren't in /builds/font.

Now, I could alter the CSS files at source to reference them absolutely BUT my application is free to distribute, so site owners use composer to bring down the fontawesome files.

So, unless basset has a way to manage fonts I'm a little stuck.

Thanks
Tom

@Anahkiasen
Copy link

Well there is the UriRewriteFilter filter but I think it's broken on develop.

@tommykent1210
Copy link
Author

Broken on develop? How about master?

Also, is there any documentation on the UriRewriteFilter? I've never really used the filters before.

I've looked at: http://jasonlewis.me/code/basset/4.0/filters

but an example would be much appreciated.

Thanks

@jasonlewis
Copy link
Owner

Is font awesome inside or outside of the public directory?

@tommykent1210
Copy link
Author

Fontawesome is located in:

ROOT_FOLDER/components/font-awesome/

Basset puts the builds in:
ROOT_FOLDER/public/builds/....

Thanks

@jasonlewis
Copy link
Owner

Yeah that probably won't work too well. They're not web accessible.
On 21 Aug 2013 03:40, "Tom Kent" [email protected] wrote:

Fontawesome is located in:

ROOT_FOLDER/components/font-awesome/

Basset puts the builds in:
ROOT_FOLDER/public/builds/....

Thanks


Reply to this email directly or view it on GitHubhttps://github.com//issues/194#issuecomment-22962657
.

@tommykent1210
Copy link
Author

hmmmm, This presents a real problem then.

My app is meant to be nice and easy to install, clone the git repo (or download the zip and upload it) the install compose and "composer install". All the configs are in the git repo so I was hoping for everything to work out of the box. I don't believe there are any easy ways to move these without manually requiring users to do it.

Any suggestions? :/

@jasonlewis
Copy link
Owner

Why can't you put all your assets in public?
On 21 Aug 2013 10:09, "Tom Kent" [email protected] wrote:

hmmmm, This presents a real problem then.

My app is meant to be nice and easy to install, clone the git repo (or
download the zip and upload it) the install compose and "composer install".
All the configs are in the git repo so I was hoping for everything to work
out of the box. I don't believe there are any easy ways to move these
without manually requiring users to do it.

Any suggestions? :/


Reply to this email directly or view it on GitHubhttps://github.com//issues/194#issuecomment-22987228
.

@tommykent1210
Copy link
Author

I could, but I'd have to move them manually. Font-awesome is installed via composer and composer puts them in /components as opposed to /public. Unless theres a way to change that?

@Anahkiasen
Copy link

On the other hand, you should not manage your front-end assets with Composer. That's not what it was meant for nor what it's useful for. I recommend you switch to an actual assets manager like Bower and create the following files at the root of your repository :

.bowerrc

{
  "directory" : "public/components"
}

bower.json

{
  "dependencies": {
    "font-awesome": "latest"
  }
}

@jasonlewis
Copy link
Owner

What Maxime said. Composer a PHP dependency manager. Use Bower, it's really
good.
On 21 Aug 2013 10:16, "Maxime Fabre" [email protected] wrote:

On the other hand, you should not manage your front-end assets with
Composer. That's not what it was meant for nor what it's useful for. I
recommend you switch to an actual assets manager like Bowerhttp://bower.io/and create the following file at the root of your repository :

.bowerrc

{
"directory" : "public/components"
}


Reply to this email directly or view it on GitHubhttps://github.com//issues/194#issuecomment-22987510
.

@petercoles
Copy link

Or if you want to stick with Composer, update your composer.json config setting to override the default location for components, e.g.

    "config": {
        "preferred-install": "dist",
        "component-dir": "public/components"
    },

@eviweb
Copy link

eviweb commented Oct 10, 2013

Hi,

I am just new to Laravel and then to Basset which seems to me a great tool, thanks Jason ;)
Going on my understanding of both products, I ran into the same issue than tommykent1210.
After having installed semantic-ui via composer, configured a collection using $collection->requireTree() method and filtered paths with UriRewriteFilter, I relied on fonts and images to be part of the collection build. But after a quick check, I realized that only js and css files have been copied to /public/build/ directory.
Aren't images and fonts considered as assets ?
IMHO, they should be included in a collection build, like js and css files are, don't you think so ?

Eric

@MonsterGfx
Copy link

For what it's worth, I solved the problem by adjusting the path in my .less file. Here's my directory tree:

public/
    fonts/   (containing my font-awesome font files)
    assets/    (as recommended by the basset docs)
    builds/    (as recommended by the basset docs)

My font-awesome variables.less file now contains the following line:

@FontAwesomePath:    "../../../../../../../font";

So that it points from the font-awesome .css file deep in the public/builds/... tree to the fonts directory in the root folder.

Not ideal, but it works. A better solution would be the one eviweb suggested: copy arbitrary assets like fonts/images/etc. to the build directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants