Hi,
8 Answers, 1 is accepted
Yes you can create SharedWebAsset and Import it in your page.
For example in global.asax application start:
SharedWebAssets.StyleSheets(group => group.AddGroup("appStyles", styles => styles.Add("site.css") .Add("openid.css") .Add("form.css") .Add("telerik.common.css") .Add("telerik.forest.css")) ); SharedWebAssets.Scripts(group => group.AddGroup("publicScripts", scripts => scripts.Add("jquery.validate.js") .Add("jquery.form.js") .Add("jquery.color.js") .Add("jquery.watermark.js") .Add("jquery.openid.js") .Add("createShortUrl.js")) );
Now in the page:
Sincerely yours,
Kazi Manzur Rashid
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
SharedWebAssets.StyleSheets(group =>
group.AddGroup("appStyles",styles => styles.Add("site.css")
.Add("openid.css")
.Add("form.css")
.Add("telerik.common.css")
.Add("telerik.forest.css"))
);
-- Web.config
<!--Web Assests--> <telerik> <webAssets> <scripts> <add name="appStyles" combined="true" compress="true" enabled="true">
</add> </scripts> </webAssets> </telerik>
It should look something like the following:
<telerik>
<webAssets>
<styleSheets>
<add name="appStyles" combined="true" compress="true">
<items>
<add source="site.css" />
<add source="openid.css" />
<add source="form.css" />
<add source="Telerik.Common.css" />
<add source="Telerik.forest.css" />
</items>
</add>
</styleSheets>
<scripts>
<add name="appScripts" combined="true" compress="true">
<items>
<add source="jquery.validate.js"/>
<add source="jquery.form.js"/>
<add source="jquery.color.js"/>
</items>
</add>
</scripts>
</webAssets>
</telerik>
Greetings,
Kazi Manzur Rashid
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I don't think you are understanding me, I'm aware of how to do it when adding new groups like you described above. However what i'm wanting is to do Declare the groups in CODE and configure their script combining in CONFIG.
So if i had in my
GLOBAL.ASAX
SharedWebAssets.StyleSheets(group =>
group.AddGroup("appStyles",styles => styles.Add("site.css")
.Add("openid.css")
.Add("form.css")
.Add("telerik.common.css")
.Add("telerik.forest.css"))
);I want to configure that groups combining and compression in
WEB.CONFIG
This way i can turn on and off the combining without having their values set in CODE. Does this make sense?
Thanks again.
Sorry I could not get your point.
You can declare the groups in the web.config like the following:
<telerik>
<webAssets>
<styleSheets>
<add name="appStyles" combined="true" compress="true"/>
</styleSheets>
<scripts>
<add name="appScripts" combined="true" compress="true"/>
</scripts>
</webAssets>
</telerik>
and then add the items with the following (check that I am using GetGroup instead of AddGroup):
SharedWebAssets.StyleSheets(group =>
group.GetGroup("appStyles",
styles => styles.Add("site.css")
.Add("openid.css")
.Add("form.css")
.Add("telerik.common.css")
.Add("telerik.forest.css"))
);
SharedWebAssets.Scripts(group =>
group.GetGroup("appScripts",
scripts => scripts.Add("jquery.validate.js")
.Add("jquery.form.js")
.Add("jquery.color.js")
.Add("jquery.watermark.js")
.Add("jquery.openid.js")
);
Greetings,
Kazi Manzur Rashid
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.