Giter VIP home page Giter VIP logo

Comments (9)

RSeidelsohn avatar RSeidelsohn commented on August 11, 2024

Currently, the most importans JS code in the index.html is written in one line, getting longer and longer with every run.

As an example, in my index.html I have this code:

<script>var results = [{"requests":{"values":[>92.000 more characters here]</script>

This is barely maintainable by a human. It would be much better to break the code into single lines, like this:

<script>var results = [
{
    /* 2014-01-01 08:15:00 */
    "requests":{
        "values":[156,156,156,156,156,null],"sum":780,"min":156,"max":156,"median":156,"average":156
    },
    "gzipRequests":{
        "values":[37,37,37,37,37,null],"sum":185,"min":37,"max":37,"median":37,"average":37
    },
    [..]
    /* 2014-01-02 08:15:00 */
    "requests":{
        "values":[156,156,156,156,156,null],"sum":780,"min":156,"max":156,"median":156,"average":156
    },
    "gzipRequests":{
        "values":[37,37,37,37,37,null],"sum":185,"min":37,"max":37,"median":37,"average":37
    },

That is, data could be split into several lines - at least one line per phantomas run, but maybe even in several lines as shown above - preceded with the corresponding human readable date and time in a separate line as JS comment, so that one can e.g. easily remove data sets from the whole code.

from grunt-phantomas.

stefanjudis avatar stefanjudis commented on August 11, 2024

@stryju can think of any way to get the requested date into it? It would be perfect then. ;)

/* 2014-01-02 08:15:00 */
"requests":{
  "values":[156,156,156,156,156,null],"sum":780,"min":156,"max":156,"median":156,"average":156
},

from grunt-phantomas.

stryju avatar stryju commented on August 11, 2024

date as object prop?

results = {
  '2014-01-01 08:15:00' : {
    'requests' : ...,
    ...
  },
  '2014-01-02 08:15:00' : { ... },
  ...
}

this would still be traversable, order is still maintained (via timestamps)

from grunt-phantomas.

stryju avatar stryju commented on August 11, 2024

the timestamp indexing sounds like a new feature - beyond the scope of this bug

@Augenfeind agreed? if so, please create a new feature request - should be able to fix up a PR for that soon ;-)

from grunt-phantomas.

stefanjudis avatar stefanjudis commented on August 11, 2024

Better, but not completely done yet.

from grunt-phantomas.

stefanjudis avatar stefanjudis commented on August 11, 2024

@Augenfeind feel free to close, if you agree with @stryju and create another feature request. :)

from grunt-phantomas.

RSeidelsohn avatar RSeidelsohn commented on August 11, 2024

@stryju I agree!
@stefanjudis You created this issue - I can not close it ;)

from grunt-phantomas.

stefanjudis avatar stefanjudis commented on August 11, 2024

Haha. :)

from grunt-phantomas.

stryju avatar stryju commented on August 11, 2024

damn - it writes the formatted json files, but not the index.html ^^

will fix that :)

from grunt-phantomas.

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.