{"id":19450906,"url":"https://github.com/morning-train/mixrc","last_synced_at":"2025-08-04T15:42:14.001Z","repository":{"id":145106914,"uuid":"149993354","full_name":"Morning-Train/mixrc","owner":"Morning-Train","description":"Laravel mix configuration made easy","archived":false,"fork":false,"pushed_at":"2018-03-21T14:45:21.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-07T23:49:14.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Morning-Train.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-09-23T14:43:07.000Z","updated_at":"2022-01-03T09:43:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"84efb330-9481-4d22-b3b2-173a707fa918","html_url":"https://github.com/Morning-Train/mixrc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morning-Train%2Fmixrc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morning-Train%2Fmixrc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morning-Train%2Fmixrc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morning-Train%2Fmixrc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Morning-Train","download_url":"https://codeload.github.com/Morning-Train/mixrc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240637767,"owners_count":19833190,"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":[],"created_at":"2024-11-10T16:39:25.154Z","updated_at":"2025-02-25T09:22:22.049Z","avatar_url":"https://github.com/Morning-Train.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mixrc\n\u003e [Laravel mix](https://github.com/JeffreyWay/laravel-mix) configuration made easy.\n\n## What is it?\n**mixrc** parses a configuration file (usually **.mixrc**) from your project root directory and automates the process of compiling assets by instructing **laravel-mix** the tasks you want to perform.\n\n## What is *laravel-mix*?\n**laravel-mix** is a wrapper around webpack that makes compiling assets a breeze. It comes bundled with [Laravel](https://laravel.com/), the popular php framework.\n\n**Can i use this outside Laravel?**\nYes, you can.\n\n**Do I have to install plugins to make it work for my project?**\nMost of the cases **no**. Mix automatically installs plugins based on your configuration and it has support for most of the  web used languages out there.\n\n## Installation\n```shell\nnpm install --save-dev mixrc\n```\n## How to use outside Laravel\nAdd these lines to your **package.json** under section **scripts**:\n```json\n\"dev\": \"npm run development\",\n\"development\": \"cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\",\n\"watch\": \"cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\",\n\"watch-poll\": \"npm run watch -- --watch-poll\",\n\"hot\": \"cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js\",\n\"prod\": \"npm run production\",\n\"production\": \"cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\"\n```\n\nCreate a **webpack.mix.js** file in your project root and add the following line:\n```js\nrequire('mixrc')();\n```\nCreate a **.mixrc** file in your project root and add the following lines:\n```json\n{\n  \"entries\": {\n    \"sass\": [\n      \"src/sass/app.scss\"\n    ],\n    \"js\": [\n      \"src/js/app.js\"\n    ]\n  },\n  \"output\": {\n    \"sass\": \"assets/css\",\n    \"react\": \"assets/js\",\n  }\n}\n```\nAdd the assets to your **html**:\n```html\n\u003clink href=\"/assets/css/app.css\" /\u003e\n\u003cscript src=\"/assets/js/app.js\"\u003e\u003c/script\u003e\n```\nBuild:\n```shell\nnpm run dev\n```\n\n## How to use with Laravel\nBefore you install mixrc, make sure you remove the existing dependencies for **laravel-mix**, **cross-env** and any previous version of **mixrc**. You can do this easily by executing the following command on your project root directory:\n```shell\nnpm uninstall --save-dev cross-env laravel-mix mixrc \u0026\u0026 npm install --save-dev mixrc \u0026\u0026 npm install\n```\nIn your **webpack.mix.js** file remove everything and add this line:\n```js\nrequire('mixrc')();\n```\nCreate a **.mixrc** file in your project root and add the following lines:\n```json\n{\n  \"entries\": {\n    \"sass\": [\n      \"resources/assets/sass/app.scss\"\n    ],\n    \"js\": [\n      \"resources/assets/js/app.js\"\n    ]\n  },\n  \"output\": {\n    \"sass\": \"public/css\",\n    \"react\": \"public/js\",\n  }\n}\n```\nAdd these lines to your **blade**:\n```html\n\u003clink href=\"{{ mix('css/app.css') }}\" /\u003e\n\u003cscript src=\"{{ mix('js/app.js') }\"\u003e\u003c/script\u003e\n```\n\n## Advanced usage\n\n\u003e For a quick list of the supported features and defaults check the [blueprint](blueprint.mixrc) configuration file.\n\n### ES6 and React\nConfigure **.mixrc** to compile javascript with **react** support.\n```json\n{\n  \"entries\": {\n    \"react\": [\n      \"resources/assets/js/app.js\"\n    ]\n  },\n  \"output\": {\n    \"react\": \"public/js\",\n  }\n}\n```\n\u003e Advanced **babel configuration** can be done via **.babelrc**\n\n### Working with stylesheets\n**Laravel mix** supports compiling from a large set of stylesheet languages. You can find more about it [here](https://laravel.com/docs/5.5/mix#working-with-stylesheets).\n\nHere is an example on how you can achieve this with **.mixrc** configuration file:\n```json\n{\n  \"entries\": {\n    \"sass\": [\n\t\t\"resources/assets/sass/app.scss\"\n    ],\n    \"less\": [\n\t\t\"resources/assets/sass/app.less\"\t\n    ]\n  },\n  \"output\": {\n    \"sass\": \"public/css/sass\",\n    \"less\": \"public/css/less\"\n  }\n}\n```\n### Vendor modules\nYou can compile your vendor modules in a separate **vendor.js** file by adding the following section to your **.mixrc** configuration file:\n```json\n\"extract\": {\n    \"path\": \"public/js/vendor.js\",\n    \"modules\": [\n      \"react\",\n      \"react-dom\",\n      \"axios\"\n    ]\n  }\n```\nThis is very efficient in development as the vendor won't be compiled every time the source changes.\n\u003e Using the **extract** option will generate additional two files: **manifest.js** and **vendor.js**. Make sure you include them in your **html**.\n```html\n\u003c!-- Vendor scripts --\u003e\n\u003cscript src=\"/assets/js/manifest.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/assets/js/vendor.js\"\u003e\u003c/script\u003e\n\n\u003c!-- App script --\u003e\n\u003cscript src=\"/assets/js/app.js\"\u003e\u003c/script\u003e\n```\n### Autoload modules\nYou can autoload modules that will be globally available within your code by adding the following section to your **.mixrc** configuration file:\n```json\n\"autoload\": {\n    \"moduleName\": [\n\t    \"globalVariable1\",\n\t    \"globalVariable2\"\n    ]\n}\n```\nFor example this code will make **jquery** globally available within your bundle as **jQuery** and **$**:\n```json\n\"autoload\": {\n    \"jquery\": [\n\t    \"jQuery\",\n\t    \"$\"\n    ]\n}\n```\n### Aliases\nAliases are one of the best solutions available when having to deal with large directory structures and inevitably with the **require('../../../myModule')**. You can mark any of your project folders as \"modules\" as in the following example:\n```json\n\"aliases\": {\n\t\"components\": \"src/js/components\"\n}\n```\nThen, in your script you can load files under that folder by requiring it directly:\n```js\n// CommonJS\nconst MyComponent = require(\"components/MyComponent\");\n// ES6\nimport MyComponent from \"components/MyComponent\";\n```\n### Tweaks\n\n\u003e **notifications** (default: *false*)\n\u003e ```json\n\u003e \"notifications\": true\n\u003e ```\n\n\u003e **version** (default: *false*)\n\u003e Use this option with Laravel and function **mix**.\n\u003e ```json\n\u003e \"version\": true\n\u003e ```\n\n\u003e **sourceMaps** (default: *true*)\n\u003e ```json\n\u003e \"sourceMaps\": false\n\u003e ```\n\n\u003e **processCssUrls** (default: *false*)\n\u003e laravel-mix has this option turned on by default but I found it fairly buggy. \n\u003e ```json\n\u003e \"processCssUrls\": true\n\u003e ```\n\n\u003e **publicDirectory** (default: *null* = *auto*)\n\u003e Guesses the directory by default based on your laravel/non-laravel setup.\n\u003e You may specify a string in order to change it:\n\u003e ```json\n\u003e \"publicDirectory\": \"path/to/public\"\n\u003e ```\n\n### One file setup\nYou may choose to configure **mixrc** within a single file: **webpack.mix.js**.\n```js\nrequire(\"mixrc\")({\n\t// enable/disable notifications\n\tnotifications: false,\n\n\t// mix-manifest version\n\tversion: false,\n\n\t// source maps\n\tsourceMaps: true,\n\n\t// process css urls (bugging sometimes)\n\tprocessCssUrls: false,\n\n\t// i/o\n\tentries: {},\n\toutput: {},\n\n\t// vendor bundle\n\textract: {},\n\n\t// autoload globals\n\tautoload: {},\n\n\t// path aliases\n\taliases: {}\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorning-train%2Fmixrc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorning-train%2Fmixrc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorning-train%2Fmixrc/lists"}