使用baseUrl影响到我的资产的路径 [英] using baseUrl affects the path to my assets
问题描述
我正在将 ember-cli
应用程序集成到我的主站点
中,该URL可以通过url http://host/faq/....ember...routes
I'm integrating an ember-cli
app inside my main site
which will be accessible at url http://host/faq/....ember...routes
所以我添加了 baseUrl:/ faq /
到我的ember
So I added baseUrl: /faq/
to my ember
config / environment.js
module.exports = function(environment) {
var ENV = {
modulePrefix: 'faq',
environment: environment,
baseURL: '/faq/',
locationType: 'hash',
问题:在我的ember-cli环境中使用 ember服务器
开发我的资产,例如( SVG,FONTS和图片)现在给我一个 NOT FOUND
The problem: While developing in my ember-cli environment with ember server
my assets such as (SVG, FONTS and IMAGES) are giving me a NOT FOUND
now.
例如: http://host/assets/images/bg.png
给我一个未找到它现在期望 http:// host / faq /资产/图像/ bg.png
。为什么会这样呢?
For example: http://host/assets/images/bg.png
gives me a not found it now expects http://host/faq/assets/images/bg.png
. Why is this happening?
推荐答案
我与此项目有同样的问题: Ember-Material-Navigation
I had the same problem with this project: Ember-Material-Navigation
我通过在我的...中定义一个baseUrl变量来解决这个问题主要sass文件并连接到所有外部网址。
I fixed this issue by defining a baseUrl variable in my main sass file and concatenating to all external urls.
$baseUrl: "/faq/";
@include font-face("Font Name", font-files($baseUrl + "/dir/font.ttf"));
但是,这只适用于您使用sass。
However, this only works if you are using sass.
这篇关于使用baseUrl影响到我的资产的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!