Got warnings from Theme-Check plugin about "Both DOS and UNIX style line endings". What does it mean!?


#1

Hi guys,

While I’m testing my theme with Theme-Check plugin, I got some warning:

WARNING: Both DOS and UNIX style line endings were found in the file theme-options.php. This causes a problem with SVN repositories and must be corrected before the theme can be accepted. Please change the file to use only one style of line endings.

There are 2 files that raise this warning, theme-options.php and style.css.

What does it mean exactly about this kind of warning and how to solve it? :expressionless:

Thanks in advanced for your advices. :slight_smile:


#2

Try this -> http://wordpress.org/support/topic/dos-and-unix-style-line-endings-in-functionsphp-how-make-them-the-same


#3

Thanks DimiR! That really helps! :smiley:

In case of anyone who uses Aptana Studio and face this warning, go to “File > Convert Line Delimeters To > …”

:slight_smile:


#4
UXbarn said

Thanks DimiR! That really helps! :smiley:

In case of anyone who uses Aptana Studio and face this warning, go to “File > Convert Line Delimeters To > …”

:slight_smile:

Thanks, Aptana solved issue :slight_smile:


#5

Bumping this up…

How about a css file that is generated from a less file and compiled through less.inc.php?

Themecheck + Themeforest Check throws out this warning but I’m not sure how to fix this, If I open and re-save the generated file with some text editor the error obviously disappear, but as soon as it regenerates same error shows up again.

Will this actually be critical in the review process?

Thanks!


#6

Yes, it is critical and still required to fix the error. :slight_smile:


#7

Thanks for your answer even though that’s not exactly what I wanted to hear :slight_smile:

Does anybody have any suggestion on how to fix this? That’s what the PHP less compiler throws out I have no idea how to affect the output in order to fix this warning…!


#8

lol Aptana


#9
djwd said

Thanks for your answer even though that’s not exactly what I wanted to hear :slight_smile:

Does anybody have any suggestion on how to fix this? That’s what the PHP less compiler throws out I have no idea how to affect the output in order to fix this warning…!

Why ThemeCheck detects it? Do you save the CSS directly in theme? If so, then you don’t do it right because you must save any custom generated CSS in wp-uploads directory.


#10
Smartik said

Why ThemeCheck detects it? Do you save the CSS directly in theme? If so, then you don’t do it right because you must save any custom generated CSS in wp-uploads directory.

That’s the main CSS file for the theme, why should I put it outside theme folder?


#11
djwd said
Smartik said

Why ThemeCheck detects it? Do you save the CSS directly in theme? If so, then you don’t do it right because you must save any custom generated CSS in wp-uploads directory.

That’s the main CSS file for the theme, why should I put it outside theme folder?

I still don't understand how do you use the "less.inc.php". Can you exaplain what's the use of it? If you're using it to pre-process the CSS(less), then you should use a local software that offer more options. The one I use is PrePos and it's free.

When I say that you should save the CSS in ‘wp-uploads’ I mean custom CSS, that you don’t want to be overided on a theme update. Also, it’s a very bad practice to generate dynamic files inside of ‘themes’ folder.

Please explain what’s the purpose of “less.inc.php”.


#12
Smartik said

I still don’t understand how do you use the “less.inc.php”. Can you exaplain what’s the use of it? If you’re using it to pre-process the CSS(less), then you should use a local software that offer more options. The one I use is PrePos and it’s free.

When I say that you should save the CSS in ‘wp-uploads’ I mean custom CSS, that you don’t want to be overided on a theme update. Also, it’s a very bad practice to generate dynamic files inside of ‘themes’ folder.

Please explain what’s the purpose of “less.inc.php”.

This is a bit off topic, but could you please explain, or link some source that explains why it should be considered as ‘very bad practice’? (no sarcasm, really interested)

I use it to generate the main.css file on the fly from a .less source file. The main.css file only gets re-generated if the original less file is modified, otherwise no action will be taken and main.css will be enqueued normally.

This way server php resources usage is very limited and it only takes place when needed (e.g after a theme update or if the users manually edit less files)

Pros:

  • You can pass user customizations as variables and output them directly to the main.css file (!)
  • The development workflow is much quicker and there's no need of any offline preprocessor
  • Advanced users can directly edit well organized less files if they want to, and still get a compressed single css file on front-end automatically.

Cons:

  • - ?

Back in Topic, I were able to fix the issue and remove the line endings by minifying the output using the setFormatter method

$less = new lessc;
$less->setFormatter(“compressed”);


#13
djwd said

This is a bit off topic, but could you please explain, or link some source that explains why it should be considered as ‘very bad practice’? (no sarcasm, really interested)

I use it to generate the main.css file on the fly from a .less source file. The main.css file only gets re-generated if the original less file is modified, otherwise no action will be taken and main.css will be enqueued normally.

One important reason: The theme should stay untouched. The user should never alter the files from a theme or plugin if is developed by somebody else.

You say that this is not a problem, because nothing is lost, but I can say the opposite. Even if you modify just a simple stylesheet, this means you’ve modified everything. Why? I tell you. To understand it better, I’ll give you an example:

Suppose that a user use your theme, he loves it so much that decided to purchase another 3 licences for other 3 sites. Now that uses is going to use your theme on 4 sites, all these 4 sites share similar content so it makes sense to use the same theme. Also all these 4 sites are from one WordPress Multisite installation. Now, you see where is the problem? No? Ok, let’s continue then.

That user want to use your theme on all these 4 sites but on each site to have a different color scheme. That means that he would adjust the settings on each site from admin.
Ifthe theme will save the generated CSS in its folder, then the user will not be able to have a different color scheme for each site because every time he adjust the settings for a site it will overide the generated CSS for other sites.

That’s why you should save the generated CSS in wp-uploads folder with a unique stylesheet name for each theme and website.

Cheers.


#14
djwd said

Thanks for your answer even though that’s not exactly what I wanted to hear :slight_smile:

Does anybody have any suggestion on how to fix this? That’s what the PHP less compiler throws out I have no idea how to affect the output in order to fix this warning…!

Try this https://github.com/sanchothefat/wp-less
I used wp less with less php and it worked fine. No errors during the theme check too.


#15
Smartik said
djwd said

This is a bit off topic, but could you please explain, or link some source that explains why it should be considered as ‘very bad practice’? (no sarcasm, really interested)

I use it to generate the main.css file on the fly from a .less source file. The main.css file only gets re-generated if the original less file is modified, otherwise no action will be taken and main.css will be enqueued normally.

One important reason: The theme should stay untouched. The user should never alter the files from a theme or plugin if is developed by somebody else.

You say that this is not a problem, because nothing is lost, but I can say the opposite. Even if you modify just a simple stylesheet, this means you’ve modified everything. Why? I tell you. To understand it better, I’ll give you an example: …

Cheers.

That’s a scenario I haven’t thought about actually, btw even though I said it’s possible, I’m not using the compiler for user customizations. In that case I’ll definitely output the file in wp-uploads as you say and still benefit of other advantages, no big deal. :grin:

bootstrapguru said

Try this https://github.com/sanchothefat/wp-less
I used wp less with less php and it worked fine. No errors during the theme check too.

Thanks for the heads up, I’ll check up on that


#16

The same thing for me, but i use node.js less compiler to compile main theme files. If i check it in phpstorm or notepad++ it shows that only Windows (CRLF) line endings used, but that plugin says it use both DOS(LF) and Windows(CRLF) line endings.

But no, there is no LF anywhere in my CSS.

And what futher… I had spaces instead tabs in CSS, and after i have reformated all CSS it shows no errors.

Hope that will help someone.