greenlaw110 / greenscript

A tool help web developers manage javascript/css rendering, including minimize and dependence management
42 stars 24 forks source link

Unnecessary empty lines #9

Closed Pyppe closed 13 years ago

Pyppe commented 13 years ago

greenscript module (version 1.2c) inserts a lot of unnecessary empty lines in the HTML source when used. I'd like to see this issue fixed.

Pyppe commented 13 years ago

For example, I've got the following head-element in my main.html:

<head>
    <title>My site &raquo; #{get 'title' /}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    #{greenscript.css 'jquery-ui/jquery-ui-1.8.7.custom main', output:'all'/}
    <link rel="shortcut icon" type="image/png" href="@{'/public/images/favicon.png'}"/>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
    #{greenscript.js 'jquery.kuntokanta jquery.json-2.2.min jquery.form-2.61.min' /}
    #{greenscript.js output:'all' /}
</head>

This HTML-snippet of 10 lines results in whopping 93 lines in generated HTML source code. So the problem is quite big IMO.

greenlaw110 commented 13 years ago

Basically this is not a greenscript specific issue, but rather associated with play template system. See this thread: http://groups.google.com/group/play-framework/browse_thread/thread/c09426c5cfa86d28/c4d97ef03f5cc148?lnk=gst&q=white+space#c4d97ef03f5cc148

One possible way to reduce the number of empty lines might be remove all line terminate from the greenscript tag files. But I prefer not to do that.

Pyppe commented 13 years ago

Why not make a "release script"? It could basically be a simple shell script that would remove all the empty lines from the tag files upon new release? That way, you could still keep the code base clean and readable.

Just a suggestion. :)

greenlaw110 commented 13 years ago

hmm... the only place to do "release" as far as I know is when you run play build-module. I am not sure if there are hooks for plugin contributor to run customized "release script". I will put this to my to-do list. If you have better idea, please let me know.