• Resolved aramaz

    (@aramaz)


    Hi,

    I have set up a project in Netbeans with existing WordPress files, downloaded from the live server of a site. The encoding of the project is UTF-8. The problem is, whenever I save a file (style.css for example) in Netbeans, it messes up my code, and WP doesn’t recognize it in the theme editor. The code doesn’t have any line breaks, but looks like this:

    z-index: -1; overflow-x: hidden; }#header { width: 100%; height: 130px; overflow-x: hidden;}#footer {...}

    ie. one big line of code, which makes WP not recognize the css template. Same thing with .php files and also if I save in Notepad++.

    How do I solve this? Do I have to use ANSI? How do I use ANSI in Netbeans? I don’t see it in the encoding list in the project setup.

    Any experience with this issue will help. Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Did you talk to Netbeans’ and Notepad++ support about this? I’ve never had this problem myself.

    Thread Starter aramaz

    (@aramaz)

    I haven’t but I can try. Are you a Netbeans user? What kind of encoding do you use for WP projects?

    I seem to recall Netbeans being mentioned as causing problems a few years back. Unfortunately, I don’t use it myself, so can’t offer much in the way of suggestions.

    I’ll see if I can get some more eyes on this..

    Thread Starter aramaz

    (@aramaz)

    Thanks Esmi.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Are you sure your theme or a plugin is not doing some sort of minification?

    Thread Starter aramaz

    (@aramaz)

    Thing is, I am running W3 Total Cache, but it shouldn’t minify themes in the admin, especially themes that are not active, right?

    I couldn’t say for sure as I don’t have personal experience with W3TC. Can you temporarily disable it to see if that helps?

    Thread Starter aramaz

    (@aramaz)

    Actually, now that I’ve analysed it a bit more, it’s the same on the local copy of the site, which isn’t running any caching.

    Aramaz, this seems like a line endings issue. Your live server, from which you downloaded the files, is most likely running Unix. Your local machine probably isn’t. The two OSs use different line endings

    I don’t think W3TC is the issue here; if it was, php files wouldn’t be affected.

    As of Netbeans 7.3, there is a new change-line-endings-on-save plugin that allows you to configure line endings globally or on a per-project basis. Check it out here

    Thread Starter aramaz

    (@aramaz)

    That’s a good suggestion Kakoma. I remember reading about this a while ago and somebody mentioned something similar.

    I downloaded and installed the plugin. If I download a .css or .php file from the server what kind of a line-ending should I set up in the plugins config – Unix (LF) or Windows (CRLF)? I am using Windows and the server is Unix.

    I suggest you use UNIX line endings. NetBeans will display the file fine on your PC but on save (and subsequent upload), it’ll use UNIX-which is what your server needs

    Thread Starter aramaz

    (@aramaz)

    Good call, thanks. The issue seems resolved now!

    Awesome!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘style.css (and other files) messed up after saving in Netbeans/Notepad’ is closed to new replies.