2

このコードを1行に最小化する必要があります。

私はAdobeEdgeを使用しており、1つのテキストボックス内のいくつかの段落のコードを作成しています。興味がある場合は、コードをと呼ばれる領域にロードする必要がありますdocument.compositionReady

大きな制限は、JavaScriptを介してコードをロードする方法では、複数行を使用できないことです。

だから私はすでにこれを手動で行っており、それは問題ではありません、それはうまくいきますが、それは長い時間がかかります。Aptana studioをformatコマンドで使用して、コードを通常の状態に解凍できます。問題は、開発中にこのコードを手動で1行に圧縮する必要があり、時間がかかり、気が散ることです。

だから私はこれを回すことができる手動ツールが必要です:

<style media='screen' type='text/css'>
    .text {
        padding: 1px 1px 1px 1px;
        font-size: 12px;
    }
</style>

<!-- now for html -->

<div style='width:550px;' >
    <div style='float:left;font-size:1.2em;' class='text'>
        Title goes here
    </div>
    <div style='width:60px;float:left;' class='text'>
        <span style='font-size:0.8em;'>
            ®
        </span>
    </div>
    <div style='float:left' class='text'>
        Some paragraph text
    </div>
    <div style='float:left;padding-top:10px;' class='text'>
        <span style='font-style:italic;'>
            A footer to the paragraph
        </span>
    </div>
</div>

これに:

<style media='screen' type='text/css'>.text {padding: 1px 1px 1px 1px;font-size:12px;}</style><!-- now for html --><div style='width:550px;' >  <div style='float:left;font-size:1.2em;' class='text'>MY BRILLIANCE</div><div style='width:60px;float:left;' class='text'>      <span style='font-size:0.8em;'>®</span> </div>  <div style='float:left' class='text'>       With release comes growth, through challenge comes wisdom, let us show you the way. </div>  <div style='float:left;padding-top:10px;' class='text'><span style='font-style:italic;'>Absolute Equal Acceptance through Thought, Conscience and Reunion.</span></div></div>
4

2 に答える 2

4

まあ、グーグルはあなたの友達かもしれません。

http://www.textfixer.com/html/compress-html-compression.php

<style media='screen' type='text/css'>
    .text {
        padding: 1px 1px 1px 1px;
        font-size: 12px;
    }
</style>

<!-- now for html -->

<div style='width:550px;' >
    <div style='float:left;font-size:1.2em;' class='text'>
        Title goes here
    </div>
    <div style='width:60px;float:left;' class='text'>
        <span style='font-size:0.8em;'>
            ®
        </span>
    </div>
    <div style='float:left' class='text'>
        Some paragraph text
    </div>
    <div style='float:left;padding-top:10px;' class='text'>
        <span style='font-style:italic;'>
            A footer to the paragraph
        </span>
    </div>
</div>

になります

<style media='screen' type='text/css'> .text { padding: 1px 1px 1px 1px; font-size: 12px; }</style><!-- now for html --><div style='width:550px;' > <div style='float:left;font-size:1.2em;' class='text'> Title goes here </div> <div style='width:60px;float:left;' class='text'> <span style='font-size:0.8em;'> ® </span> </div> <div style='float:left' class='text'> Some paragraph text </div> <div style='float:left;padding-top:10px;' class='text'> <span style='font-style:italic;'> A footer to the paragraph </span> </div></div>

または、デスクトップで直接圧縮する場合は、 AlentumHTMLCompressorなどのソフトウェアを使用できます。

于 2013-02-17T16:34:24.307 に答える
-1

のようなものstr_replace("\n", "", $text_to_be_compressed)

于 2013-02-17T16:32:56.813 に答える