{"action":"created","issue":{"url":"https://api.github.com/repos/jnordberg/wintersmith/issues/273","labels_url":"https://api.github.com/repos/jnordberg/wintersmith/issues/273/labels{/name}","comments_url":"https://api.github.com/repos/jnordberg/wintersmith/issues/273/comments","events_url":"https://api.github.com/repos/jnordberg/wintersmith/issues/273/events","html_url":"https://github.com/jnordberg/wintersmith/issues/273","id":55001994,"number":273,"title":"Browserifying article js embeds","user":{"login":"gamecubate","id":1483884,"avatar_url":"https://avatars.githubusercontent.com/u/1483884?v=3","gravatar_id":"","url":"https://api.github.com/users/gamecubate","html_url":"https://github.com/gamecubate","followers_url":"https://api.github.com/users/gamecubate/followers","following_url":"https://api.github.com/users/gamecubate/following{/other_user}","gists_url":"https://api.github.com/users/gamecubate/gists{/gist_id}","starred_url":"https://api.github.com/users/gamecubate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamecubate/subscriptions","organizations_url":"https://api.github.com/users/gamecubate/orgs","repos_url":"https://api.github.com/users/gamecubate/repos","events_url":"https://api.github.com/users/gamecubate/events{/privacy}","received_events_url":"https://api.github.com/users/gamecubate/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-21T10:33:28Z","updated_at":"2015-01-21T10:47:58Z","closed_at":null,"body":"One of my articles needs to run some javascript code. I'd like to \"require\" some npm installed modules in this code. Am I correct in assuming that this is the \"standard\" way of doing it in Wintersmith?\r\n\r\n1. add a ```<script src=\"bundle.js\"></script>``` element somewhere in the article.\r\n2. create main.js and store it in the article's directory. Example: ``` var unique = require('uniq'); console.log(unique([1, 2, 2, 3, 4, 5, 5, 5, 6])); ```\r\n3. from inside the article directory (contents/articles/the-article/), do:\r\n```\r\nnpm install uniq\r\nbrowserify main.js -o bundle.js\r\n```\r\n\r\nI assume this will work (not tested yet) but it seems inefficient, repetitive, especially once I need to repeat this procedure for other articles.\r\n\r\nLooking for a better way (and not even sure this is the right place to ask such questions).\r\n\r\nAny hints appreciated. Thanks.\r\n"},"comment":{"url":"https://api.github.com/repos/jnordberg/wintersmith/issues/comments/70817612","html_url":"https://github.com/jnordberg/wintersmith/issues/273#issuecomment-70817612","issue_url":"https://api.github.com/repos/jnordberg/wintersmith/issues/273","id":70817612,"user":{"login":"gamecubate","id":1483884,"avatar_url":"https://avatars.githubusercontent.com/u/1483884?v=3","gravatar_id":"","url":"https://api.github.com/users/gamecubate","html_url":"https://github.com/gamecubate","followers_url":"https://api.github.com/users/gamecubate/followers","following_url":"https://api.github.com/users/gamecubate/following{/other_user}","gists_url":"https://api.github.com/users/gamecubate/gists{/gist_id}","starred_url":"https://api.github.com/users/gamecubate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamecubate/subscriptions","organizations_url":"https://api.github.com/users/gamecubate/orgs","repos_url":"https://api.github.com/users/gamecubate/repos","events_url":"https://api.github.com/users/gamecubate/events{/privacy}","received_events_url":"https://api.github.com/users/gamecubate/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T10:47:58Z","updated_at":"2015-01-21T10:47:58Z","body":"Several -- i.e., not all -- pages will have their own, unique main.js file. Perhaps I can add a top-level browserify watcher that recursively checks the contents/ hierarchy for main.js files to bundle. Not sure how to do this, though. Will have to dig deeper. Thanks for the advice."}}