GithubHelp home page GithubHelp logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
You mean if you have html:

<link href="/css/styles.css" rel="stylesheet" type="text/css"/>
<script src="/js/script.js"></script>

it would turn into:

<style>
    //styles.css content
</style>
<script>
    //script.js content
</script>


The problem is how to identify those files, lets say you have:

<script src="http://example1.com/script.js"></script>
<script src="http://example2.com/js/script.js"></script>
<script src="script.js"></script>
<script src="../../script.js"></script>

Which parameters to pass to the compressor that would indicate which script to 
replace with which file?

Original comment by [email protected] on 10 Jul 2011 at 4:11

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
Sorry, I haven't been clear; The files would passed to the compressor via 
parameters like --external-js, --external-css.
Converting HTTP requests to inline JS/CSS is another concern.

Original comment by [email protected] on 10 Jul 2011 at 5:37

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
But how to figure out which file to insert into which position? You can't just 
provide a list of filenames as the same filename could mean different script 
(as shown in the example above). It should be something like key value pairs:

"script.js" -> "c:/dir1/script.js"
"../../script.js" -> "c:/dir2/script.js"

Original comment by [email protected] on 10 Jul 2011 at 5:50

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
Ah, no, actually the HTML file would *not* have links to the JS/CSS files like 
<script src=script.js></script>. One would just specify the wanted files and 
they would be injected in the <head> of the HTML.

Original comment by [email protected] on 10 Jul 2011 at 5:58

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
Hm, I don't see a point then. What is the purpose of this feature? How are you 
going to develop the page without css or js in it? Why would you want to insert 
them only at the compression stage without even having control where on the 
page they will be inserted (which is important)? Inserting javascript into 
<head> should be your last option if you care about optimization.

I could understand replacing existing tags with inline content to save http 
requests, but what you are describing looks like some very exotic task I am not 
sure anyone else would ever use.

Original comment by [email protected] on 10 Jul 2011 at 6:23

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
Yes, said like that... I guess that would just suit my specific need.

Although, following your method, one could pass each file to the script with 
--external scripts.js=c:/dir1/script.js and so on. What do you think?

Original comment by [email protected] on 10 Jul 2011 at 6:34

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
I will probably wait for more feedback to see if anyone else needs this feature 
before implementing it.

Original comment by [email protected] on 10 Jul 2011 at 9:23

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
[deleted comment]

from htmlcompressor.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 28, 2024
Hi, I'd like to see this feature added to the taglib.  It could work the way 
"packtag" currently does... you specify a "src" attribute with either CSS or JS 
URLs.  These URLs can be both external and/or internal.  For example,

<pack:script>
<src>/assets/javascripts/library/prototype/prototype.js</src>
<src>http://code.jquery.com/jquery-latest.js</src>
</pack:script>

<pack:style>
<src>/assets/stylesheets/common/normalize.css</src>
<src>/assets/javascripts/library/jquery/jquery-ui/css/smoothness/jquery-ui.css</
src>
</pack:style>

Original comment by [email protected] on 2 Oct 2012 at 12:25

from htmlcompressor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.