rotundasoftware / cartero

Modular front end development for multi-page web applications.
MIT License
204 stars 25 forks source link

change metaData.assetMap to path from packageId dir #46

Closed butterywombat closed 8 years ago

butterywombat commented 8 years ago

This changes the assetMap to have more useful and necessary info of how to find the asset (not just the file name), or else this info would have to be looked up again in the packageMap by the user. The url transformer was modified to work with the new changes (and cartero node hook PR: https://github.com/rotundasoftware/cartero-node-hook/pull/7 ) @ferlores @dgbeck

metaData.json example BEFORE:

{
    "formatVersion": 2,
    "packageMap": {
        "/opensource/cartero/test/example4/views/page1": "55bbfe0c28f363ea56bed73fc9e41f444acf81c3"
    },
    "entryPointMap": {
        "/opensource/cartero/test/example4/views/page1/page1.js": "55bbfe0c28f363ea56bed73fc9e41f444acf81c3"
    },
    "assetMap": {
        "/opensource/cartero/test/example4/views/page1/img/robot.png": "robot_9018f21e83ce46f3ea2e3b73e5d75ece75407df7.png"
    }
}

metaData.json AFTER:

{
    "formatVersion": 3,
    "packageMap": {
        "/opensource/cartero/test/example4/views/page1": "55bbfe0c28f363ea56bed73fc9e41f444acf81c3"
    },
    "entryPointMap": {
        "/opensource/cartero/test/example4/views/page1/page1.js": "55bbfe0c28f363ea56bed73fc9e41f444acf81c3"
    },
    "assetMap": {
        "/opensource/cartero/test/example4/views/page1/img/robot.png": "55bbfe0c28f363ea56bed73fc9e41f444acf81c3/img/robot_9018f21e83ce46f3ea2e3b73e5d75ece75407df7.png"
    }
}

also fixed readme

ferlores commented 8 years ago

For reference, here is the PR in cartero-node-hook https://github.com/rotundasoftware/cartero-node-hook/pull/7

dgbeck commented 8 years ago

Hi @dxuehu and @ferlores ,

Thanks for addressing this getAssetUrl case.

This changes the assetMap to have more useful and necessary info of how to find the asset (not just the file name), or else this info would have to be looked up again in the packageMap by the user.

That makes sense.. better to push the complexity into cartero than the hook.

We should increment the formatVersion property in the metaData to 3 so that earlier versions of the hook complain when they get this new updated format.

I have some questions on the related hook PR, will ask there.