{"id":18715177,"url":"https://github.com/bernhardwebstudio/assetic-to-webpack","last_synced_at":"2025-11-10T05:30:16.413Z","repository":{"id":95741549,"uuid":"152801449","full_name":"BernhardWebstudio/assetic-to-webpack","owner":"BernhardWebstudio","description":"A little hacky tool to refactor code from Assetic to Webpack Encore","archived":false,"fork":false,"pushed_at":"2018-10-12T20:05:30.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T09:43:11.496Z","etag":null,"topics":["assetic","refactor","symfony","webpack-encore"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BernhardWebstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-12T19:58:10.000Z","updated_at":"2022-08-30T07:05:34.000Z","dependencies_parsed_at":"2023-04-25T12:47:20.548Z","dependency_job_id":null,"html_url":"https://github.com/BernhardWebstudio/assetic-to-webpack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BernhardWebstudio%2Fassetic-to-webpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BernhardWebstudio%2Fassetic-to-webpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BernhardWebstudio%2Fassetic-to-webpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BernhardWebstudio%2Fassetic-to-webpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BernhardWebstudio","download_url":"https://codeload.github.com/BernhardWebstudio/assetic-to-webpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239576806,"owners_count":19662126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assetic","refactor","symfony","webpack-encore"],"created_at":"2024-11-07T13:07:51.595Z","updated_at":"2025-11-10T05:30:16.329Z","avatar_url":"https://github.com/BernhardWebstudio.png","language":"JavaScript","readme":"# Assetic to WebPack Encore\n\nAutomatically convert your `{% stylesheets %}` and `{% javascripts %}` into \n`asset()` tags to upgrade from assetic to WebPack Encore!\n\n## Usage\n\nAt the moment, this is a rather hacky solution. You have to:\n\n0. *Be sure to have a backup of whatever you will try to upgrade! \n***I do not take any responsibility for using this script!** \nIt will change stuff, to the better or worse, you will see!*\n1. Download/clone this repository\n2. Edit the [main](refactor-webpack.js) javascript file: in case your main Namespace \n(usually the name of the folder inside `src`) is not app, change the \n`topNamespace`-variable.\n3. Now you can run the file using node: `node (path...)/refactor-webpack.js (path to src dir)`. \n(don't copy it like that, you have to replace the stuff in paranteses, maybe even add the path to node!) \n4. Update files by hand where more than one stylesheets resp. javascripts tag was inside, \nthey should have been listed in the console you ran the script from.\n5. Modify the Webpack Encore configuration \n(if you did not yet, you will have to follow the steps listed in the [Symfony Docs](https://symfony.com/doc/current/frontend/encore/installation.html)). \n(see also [Result](#Result))\n\n## Result\n\nAll tags will be replaced by separate instances of links/script-tags with \nan `asset`-call. There will be `entries.json`-files in the `Resources/public` directory \nof your bundles. You can either process these with some other easy script or \nuse the following webpack-config to load entries dynamically from the json-files: \n\n````javascript\n\n// normal, default webpack encore config defining the `Encore` variable\n// add the following before the module.exports = Encore.... line\n\n// here we load our necessary packages\n// to load the entries.json files.\n// be sure to run `yarn add glop path fs` to fix possible issues occuring when running this file\nconst glob = require(\"glob\");\nconst fs = require(\"fs\");\nconst path = require('path');\nfunction resolvePath(entries, filepath) {\n    return path.dirname(entries) + filepath.replace(new RegExp(\"^(\\.)\"), \"\");\n}\n// change App to your top namespace\nvar files = glob.sync(__dirname + \"/src/App/*/Resources/public/entries.json\", {});\n\nfiles.forEach(file =\u003e {\n    config = JSON.parse(fs.readFileSync(file));\n    for (var key in config[\"entry\"]) {\n        Encore.addEntry(key, resolvePath(file, config[\"entry\"][key]));\n    }\n    for (var key in config[\"styleEntry\"]) {\n        Encore.addStyleEntry(key, resolvePath(file, config[\"styleEntry\"][key]));\n    }\n    for (var key in config[\"sharedEntry\"]) {\n        Encore.createSharedEntry(key, resolvePath(file, config[\"sharedEntry\"][key]));\n    }\n});\n// finally, export webpack config as in default encore config\nmodule.exports = Encore.getWebpackConfig();\n\n````\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernhardwebstudio%2Fassetic-to-webpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbernhardwebstudio%2Fassetic-to-webpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernhardwebstudio%2Fassetic-to-webpack/lists"}