Closed slickplaid closed 7 years ago
Just to comment on the 8b5b733 commit: I have no idea how those files weren't included in my original fork from your project. I've included them now.
Sorry it's taken so long to get to this. For what you are wanting, you may be able to use custom blocks. Documentation is here:
https://github.com/jonkemp/useref#custom-blocks
I was able to get your test passing this way without using your code changes.
var useref = require('useref');
var result = useref(inputHtml, {
test: function (content, target, options) {
return '<link rel="stylesheet" href="/css/combined.css"/>';
}
});
var useref = require('useref');
var result = useref(inputHtml, {
test: function (content, target, options) {
return '<script src="scripts/combined.concat.min.js">//<![CDATA[ //]]></script>';
}
});
... such as jspx which can mangle code and cause browsers to improperly format it to the user.
The Problem
I'm working on a project that utilizes Java's JSPX format which pre-processes HTML files served to the user. I am working on integrating a front-end build process to their workflow, but the JSPX processing is so heavy handed that there is absolutely no option for disabling some "features" that force empty tags into self terminating tags.
<script src="..."></script>
turns into<script src="..." />
,<link ...>
without a self terminated/
completely breaks compilation. I have looked into patching the behavior on the pre-processors end, but they give no options or concessions on that it needs to work that way.Proposed Solution
Add two options:
<link>
tag to make it self terminated<script>
tag with a CDATA tag in the empty spaceI have included a proper fix for pull request #12 and made it an option rather than forcing it for the user.
All tests and linting should be passing, although I had to make a concession to not pass the
options
object to the formatter and instead pass it to thebb
object because of some linting rules that were violated with number of arguments and number of statements in a function. Hopefully these are to the project's standards.Let me know if there's anything else I can do to get these options into the package. I'd prefer to use this widely accepted package vs. my one-off branch that includes these options for the small (but non-zero, if myself and #12 's show) amount of users who have this same problem.