.htaccess PyroCMS-资产类别不';t缩小并合并
我对资产类有一些问题,需要缩小并合并css和js。 我有这个插件广告,它似乎工作没有问题: 这是我的.htaccess文件,如您所知,我已取消对SetEnv的注释:.htaccess PyroCMS-资产类别不';t缩小并合并,.htaccess,pyrocms,.htaccess,Pyrocms,我对资产类有一些问题,需要缩小并合并css和js。 我有这个插件广告,它似乎工作没有问题: 这是我的.htaccess文件,如您所知,我已取消对SetEnv的注释: # Multiple Environment config # Set this to development, staging or production SetEnv PYRO_ENV production <IfModule mod_rewrite.c> # Make sure directory
# Multiple Environment config
# Set this to development, staging or production
SetEnv PYRO_ENV production
<IfModule mod_rewrite.c>
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
RewriteEngine on
# NOTICE: If you get a 404 play with combinations of the following commented out lines
#AllowOverride All
RewriteBase /
# Restrict your site to only one domain
# !important USE ONLY ONE OPTION
# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteCond %{HTTP_HOST} (.+)$ [NC]
#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
# Remove index.php from URL
#RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
#RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
#RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/(system\/cms\/cache|system\/codeigniter|\.git|\.hg).*$
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</IfModule>
#多环境配置
#将此设置为“开发”、“暂存”或“生产”
SetEnv PYRO_环境生产
#确保目录列表已禁用
选项+FollowSymLinks-索引
重新启动发动机
#注意:如果你得到一个404播放与以下注释线的组合
#允许超越所有
重写基/
#将您的站点仅限于一个域
# !重要信息:仅使用一个选项
#选项1:要重写“www.domain.com->domain.com”,请取消对以下行的注释。
重写cond%{HTTPS}=在…上
重写cond%{HTTP_HOST}^www\.(.+)$[NC]
重写规则^(.*)$http://%1/$1[R=301,L]
#选项2:要重写“domain.com->www.domain.com”,请取消对以下行的注释。
#重写cond%{HTTPS}=在…上
#重写cond%{HTTP_HOST}^www\..+$[NC]
#重写cond%{HTTP_HOST}(+)$[NC]
#重写规则^(.*)$http://www.%1/$1[R=301,L]
#从URL中删除index.php
#重写cond%{HTTP:X-request-With}^XMLHttpRequest$
#RewriteCond%{THE_REQUEST}^[^/]*/index\.php[NC]
#重写规则^index\.php(.*)$$1[R=301,NS,L]
#让人们远离codeigniter目录和Git/Mercurial数据
重定向匹配403^/(系统\/cms\/cache |系统\/codeigniter | \.git | \.hg)*$
#通过index.php发送请求(同样,如果是真实的文件或文件夹,则不发送请求)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]
重写规则^(.*)$index.php?/$1[L]
所以,如果我是对的,那么现在的PYRO_ENV就是“生产”
如果我刷新我的页面,css和js文件不会缩小并合并成一个文件。。。
下面是插件返回的内容
<link href="http://example:8888/addons/default/themes/mytheme/css/nivo-slider.css" rel="stylesheet" type="text/css" />
<link href="http://example:8888/addons/default/themes/mytheme/css/default.css" rel="stylesheet" type="text/css" />
你能帮我吗?这是你自己写的插件,对吗?我不明白为什么在文档中你建议人们使用
{theme\u assets:css\u files files=“file1.css,file2.css”}
,而你完全不需要自定义插件就可以这么做:
{{ asset:css file="file1.css" }}
{{ asset:css file="file2.css" }}
{{ asset:render }}
(同样是的,只要你正确设置了环境,它就会工作(你也可以修改/system/cms/config/asset.php进行测试)。这是你自己编写的插件,对吗?我很困惑为什么你在文档中建议人们使用
{theme\u assets:css\u files files=“file1.css,file2.css”}
当您无需自定义插件即可完成此操作时:
{{ asset:css file="file1.css" }}
{{ asset:css file="file2.css" }}
{{ asset:render }}
(也是的,只要正确设置了环境,它就会工作(您还可以修改/system/cms/config/asset.php进行测试).问题在于我的主机,它不允许我在.htaccess中使用
SetEnv
问题在于我的主机,它不允许我在.htaccess中使用SetEnv
如果您的主机不允许.htaccess中使用SetEnv
,您可以使用重写规则发送环境变量:
RewriteCond %{HTTP_HOST} ^local.yoursite.com$
RewriteRule (.*) $1 [E=PYRO_ENV:development]
RewriteCond %{HTTP_HOST} ^beta.yoursite.com$
RewriteRule (.*) $1 [E=PYRO_ENV:staging]
RewriteCond %{HTTP_HOST} ^yoursite.com$
RewriteRule (.*) $1 [E=PYRO_ENV:production]
默认情况下,资产缩小和合并将发生在生产或登台系统上,开发环境不会出于开发/调试目的而缩小和合并。出于测试目的,您可以在
system/cms/config/Asset.php
中重写此操作。如果您的主机不允许.htaccess中的SetEnv
,您可以使用重写规则发送环境变量:
RewriteCond %{HTTP_HOST} ^local.yoursite.com$
RewriteRule (.*) $1 [E=PYRO_ENV:development]
RewriteCond %{HTTP_HOST} ^beta.yoursite.com$
RewriteRule (.*) $1 [E=PYRO_ENV:staging]
RewriteCond %{HTTP_HOST} ^yoursite.com$
RewriteRule (.*) $1 [E=PYRO_ENV:production]
默认情况下,资产缩小和合并将发生在生产或登台系统上,开发环境不会出于开发/调试目的而缩小和合并。出于测试目的,您可以在
system/cms/config/Asset.php
中覆盖这一点。我在论坛中找到了该插件,我认为该插件非常有用我在论坛上找到了这个插件,我认为这个插件可以用来写更少的代码:)