gulp-version-number
gulp-version-number copied to clipboard
Add support for ng-href and on<events> in link tag
I found out that:
<link ng-href="themes/{{theme||'default'}}/css/style.css" rel="stylesheet" onerror="this.href='themes/experter/css/style.css'">
is being parsed as:
<link ng-href="themes/{{theme||?v=44edd1b317271634126140a94694357b'default'}}/css/style.css" rel="stylesheet" onerror="this.href='themes/experter/css/style.css'">
which is not the expected output. The expected output should be:
<link ng-href="themes/{{theme||'default'}}/css/style.css?v=44edd1b317271634126140a94694357b" rel="stylesheet" onerror="this.href='themes/default/css/style.css?v=44edd1b317271634126140a94694357b''">
I'm using version 0.1.7, using the version config as shown below:
const versionConfig = {
'value': '%MDS%',
'append': {
'key': 'v',
'to': ['js', 'css', 'sass'],
},
};
now, custom attribute supported. "append.to.{Object}.attr"
Nice. But this does not solves the problem related to ng-href , right?
attribute is ['href', 'ng-href', ...] which you want to append
Both of these attributes. As I understand, using
const versionConfig = {
'value': '%MDS%',
'append': {
'key': 'v',
'to': [
{
'type': 'js'
},
{
'type': 'css',
'attr': ['href', 'ng-href', 'onerror']
}
],
},
};
Is giving me this output
<link ng-href="themes/{{theme|| ?v=2b0b76da590ce4487593d2b93d10295c'default}}/css/style.css" rel="stylesheet" onerror="this.href=?v=2b0b76da590ce4487593d2b93d10295c'themes/default/css/style.css'">
Which is not right. I'm defining versionConfig wrong?
I think that's not a standard link 😆, it contains templates or logic. Why not use the replacement mode
I see. Even if is not a standard link, the regex used do match links should be able to deal with this (since is a valid syntax).
And did you notice that the generated onerror's attribute link is wrong too?