Skip to content

Commit

Permalink
♻️ Use shorter compiled function body ids when not on development env…
Browse files Browse the repository at this point in the history
…ironment
  • Loading branch information
skerit committed Apr 26, 2024
1 parent 1cab592 commit e3df756
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.3.20 (WIP)

* Use shorter compiled function body ids when not on development environment

## 2.3.19 (2024-04-13)

* Fix setting `value` property on a `<select>` item not changing the selected option
Expand Down
28 changes: 21 additions & 7 deletions lib/parser/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ Builder.setProperty(function only_html_allowed() {
*
* @author Jelle De Loecker <[email protected]>
* @since 2.2.0
* @version 2.2.0
* @version 2.3.20
*
* @param {string} type
* @param {string} info
*
* @return {Object}
*/
Builder.setMethod(function createFunctionBody(type, info) {

Expand All @@ -59,18 +64,27 @@ Builder.setMethod(function createFunctionBody(type, info) {
name : null,
};

let name;

if (type == 'root') {
entry.name = 'compiledView';
name = 'compiledView';
} else {
entry.name = 'cpv_' + type + '_';
name = ['cpv']

if (info) {
entry.name += Bound.String.slug(info, '_') + '_';
}
if (Blast.isDevelopment) {
name.push(type);

entry.name += entry.id;
if (info) {
name.push(Bound.String.slug(info, '_'));
}
}

name.push(entry.id);
name = name.join('_');
}

entry.name = name;

this.functions.push(entry);

this.current = entry;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hawkejs",
"description": "Asynchronous Embedded JavaScript templates",
"version": "2.3.19",
"version": "2.3.20-alpha",
"author": "Jelle De Loecker <[email protected]>",
"keywords": [
"template",
Expand Down

0 comments on commit e3df756

Please sign in to comment.