Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

ScriptTagHelper support for file globbing patterns in src #1577

Closed
DamianEdwards opened this issue Nov 18, 2014 · 5 comments
Closed

ScriptTagHelper support for file globbing patterns in src #1577

DamianEdwards opened this issue Nov 18, 2014 · 5 comments

Comments

@DamianEdwards
Copy link
Member

The ScriptTagHelper should support file globbing patterns via the asp-src attribute as a way to indicate that multiple script tags should be rendered. This simplifies the management of script references during development when used in conjunction with the proposed EnvironmentTagHelper and a task runner such as Gulp for doing script bundling & minification.

e.g.

<environment name="Development">
    <script asp-src-include="js/**/*.js" asp-src-exclude="*.min.js"></script>
</environment>
<environment names="Staging,Production">
    <script src="~/js/site.min.js"></script>
</environment>
@DamianEdwards DamianEdwards added this to the 6.0.0-rc1 milestone Nov 18, 2014
@dougbu
Copy link
Member

dougbu commented Nov 18, 2014

@DamianEdwards could you add a few details on how this enhancement would interact w/ Gulp and the #1576 enhancement? For example would Gulp generate "~/js/site.min.js"?

And should the generated scripts for #1576 also support globbing? If yes, does the primary source contain the globs while the fallback specifies only a different root URI?

@DamianEdwards
Copy link
Member Author

@dougbu Yes, it's expected Grunt/Gulp would be used to generate ~/js/site.min.js during build/publish time.

Here's a full example using both features:

<environment name="Development">
    <script src="~/lib/jquery/jquery.js"></script>
    <script src="~/lib/jquery-validation/jquery.validate.js"></script>
    <script asp-src-include="js/**/*.js" asp-src-exclude="*.min.js"></script>
</environment>
<environment names="Staging,Production">
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js"
            asp-fallback-src="~/lib/jquery/jquery.min.js"
            asp-fallback-test="window.jquery"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"
            asp-fallback-src="~/lib/jquery-validation/jquery.validate.min.js"
            asp-fallback-test="window.jquery && window.jquery.validate"></script>
    <script asp-src="~/js/site.min.js"></script>
</environment>

@yishaigalatzer
Copy link
Contributor

Should this be just part of the script tag feature design (which we didn't quite do yet)?

I like the pattern, I just want to keep the issue count under check.

@yishaigalatzer
Copy link
Contributor

Never mind, just noticed you made it go to RC rather than Beta2

@yishaigalatzer yishaigalatzer modified the milestones: Backlog, 6.0.0-rc1 Nov 26, 2014
@DamianEdwards DamianEdwards modified the milestones: 6.0.0-rc1, Backlog Dec 11, 2014
@yishaigalatzer yishaigalatzer modified the milestones: 6.0.0-beta3, 6.0.0-rc1 Jan 11, 2015
@yishaigalatzer yishaigalatzer self-assigned this Jan 23, 2015
@NTaylorMullen NTaylorMullen changed the title Tag Helpers: ScriptTagHelper support for file globbing patterns in src ScriptTagHelper support for file globbing patterns in src Jan 23, 2015
DamianEdwards added a commit that referenced this issue Feb 25, 2015
DamianEdwards added a commit that referenced this issue Feb 25, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 26, 2015
DamianEdwards added a commit that referenced this issue Feb 27, 2015
@DamianEdwards
Copy link
Member Author

Fixed in 8b64e3c

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

No branches or pull requests

3 participants