-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assets join problem #951
Comments
I try fix. Not to judge whether the CSS and js. |
As a side note: for JS files have to be joined with a semicolon — this is to make sure that there won't be a syntax error if the first JS file does not end with a semicolon or a newline. Say, first.js: alert(1) second.js: alert(2) If joined together without adding a semicolon: alert(1)alert(2) this will result in a syntax error. CSS, on the other hand, does not need such separators. |
char op[] = ";";
......
if (zend_is_true(join)) {
if (PHALCON_IS_EQUAL(type, type_css)) {
op = "";
}
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, op);
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, op);
}
} |
Please check if it is possible to do this: -char op[] = ";";
+const char *op = ";"; If yes, then |
Also just have thought of this: if (PHALCON_IS_EQUAL(type, type_css)) {
- op = "";
+ op = NULL;
}
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
- PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, op);
+ op ? (PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, op) : phalcon_cpy_wrt(filtered_joined_content, filtered_content TSRMLS_CC);
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, op);
} This will save us one memory allocation for CSS files :-) |
@sjinks I try it fail: //......
zval *type = NULL, *type_css;
const char *op = ";";
//......
PHALCON_INIT_VAR(type_css);
ZVAL_STRING(type_css, "css", 1);
//......
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
//......
if (type == NULL) {
PHALCON_INIT_VAR(type);
phalcon_call_method(type, resource, "gettype");
}
//......
if (zend_is_true(join)) {
if (PHALCON_IS_EQUAL(type, type_css)) {
zend_print_zval(type, 1);
op = "";
}
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, op);
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, op);
}
} The file end append "�CREATE", I suspect memory operation error. I try: if (zend_is_true(join)) {
if (PHALCON_IS_EQUAL(type, type_css)) {
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, "");
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, "");
}
} else {
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, ";");
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, ";");
}
}
} This ok. Use op ? (PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, op) : phalcon_cpy_wrt(filtered_joined_content, filtered_content TSRMLS_CC); Compile time warning |
Hello, I have problem with join assets. For example:
style.css
style2.css
And it joins wrong final output:
As you can see it adds ';' to the end of each file. The second CSS file does not works. When I add style ".green-color" nothing happens.
Here my php code:
The text was updated successfully, but these errors were encountered: