Git Product home page Git Product logo

asset-mix's Introduction

Hi, I'm Ishan

I am software engineer and open-source enthusiast. Currently working as back-end developer at passbolt.

Projects

  • Awesome FOSS Awesome FOSS Stars
  • CakePHP + Vue.js SPA demo application AssetMix Stars
  • AssetMix plugin for CakePHP AssetMix Stars
  • CakePHP Adapter for Inertia.js CakePHP Intertia Stars
  • Laravel TODO API Laravel TODO API Stars

To suport my work with a few bucks, consider donating:

Buy Me A Coffee

or Paypal me

Follow me

Twitter Follow LinkedIn Telegram Instagram Follow

asset-mix's People

Contributors

amayer-hc avatar andream98 avatar deepsourcebot avatar dereuromark avatar glennforrest avatar hevertonfreitas avatar ishan-biztech avatar ishanvyas22 avatar lordsimal avatar markstory avatar robertpustulka avatar toggenation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

asset-mix's Issues

Additional information for server-side setup: must disable Cake asset timestamping

Is your feature request related to a problem? Please describe.
Yes, a problem I had while setting up this library on a Cake3 application. With asset timestamping (Asset.timestamp => true or 'force' in app.php) enabled, AssetMix will fail to find the manifest. This is because Cake appends a timestamp to the end of the asset URL which means the "path" is not found in the mix manifest.

I'm new to this plugin and to mix/manifests in general, so I apologize if my terminology is inaccurate.

Describe the solution you'd like
Either update the docs to indicate that this setting should be turned off OR find a way for the manifest loader to ignore the timestamp in the query string when loading the asset file.

Describe alternatives you've considered
N/A

Additional context
Screen Shot 2022-04-29 at 10 30 35

AssetMix load error

image

When I execute "npm run dev" I get this error. I have loaded the AssetMix helper in the AppView file also.

Update bootstrap version to 5

Since there is no special bootstrap 4 functionality present (as far as I have seen) in this plugin I would guess it wouldn't be a problem to update the default generated package.json and stubs to use bootstrap 5 instead of 4.

Upgrade Laravel Mix version to 6.x

As describe in issue #30 (comment), it seems like there's security vulnerabilities in current packages versions which causes Laravel Mix version to bump up to 6.x.

To prevent this issue from happening it would be wise to upgrade the Laravel Mix version along with other dependencies.

Tailwind Integration

Is your feature request related to a problem? Please describe.
I'm using Tailwind to build the Cake App UI and would like to use Tailwind together with Vue.js

Describe the solution you'd like
As i know Laravel-Mix has an Tailwind Plugin and i think this could be used within your Plugin

Describe alternatives you've considered
If an integration is not possible i have to use Laravel-Mix directly

Additional context
no additional context here

Deprecation warnings

Describe the bug
Hi, i'm new with react and laravel mix.
I'm trying to create an app when I get two deprecation warnings:

Router::plugin() is deprecated, use the non-static method RouterBuilder::plugin() instead. - /Applications/MAMP/htdocs/cakereact/vendor/ishanvyas22/asset-mix/config/routes.php, line: 11
You can disable all deprecation warnings by setting Error.errorLevel to E_ALL & ~E_USER_DEPRECATED, or add vendor/ishanvyas22/asset-mix/config/routes.php to Error.ignoredDeprecationPaths in your config/app.php to mute deprecations from only this file. [CORE/src/Core/functions.php, line 322]

Router::scope() is deprecated, use the non-static method RouterBuilder::scope() instead. - /Applications/MAMP/htdocs/cakereact/vendor/cakephp/cakephp/src/Routing/Router.php, line: 912
You can disable all deprecation warnings by setting Error.errorLevel to E_ALL & ~E_USER_DEPRECATED, or add vendor/cakephp/cakephp/src/Routing/Router.php to Error.ignoredDeprecationPaths in your config/app.php to mute deprecations from only this file. [CORE/src/Core/functions.php, line 322]

How to pass Configure variables from PHP --> JS

Hi,
is there a way to pass my configuration variables from PHP to JS?
For example: application logo, email, url, etc
Where should we store SPA configurations? (Like in .env files)

Thanks
Massimo

ERROR in multi ./assets/js/app.js ./assets/sass/app.sass Module not found: Error: Can't resolve

For custom directories (other than assets), webpack.mix.js file's content generates invalid result on npm run dev command.

Current webpack.mix.js file content:

const mix = require('laravel-mix');

mix.setPublicPath('./webroot')
  .js('assets/js/app.js', 'webroot/js')
  .sass('assets/sass/app.sass', 'webroot/css')
  .version();

It should be:

const mix = require('laravel-mix');

mix.setPublicPath('./webroot')
  .js('resources/js/app.js', 'webroot/js')
  .sass('resources/sass/app.sass', 'webroot/css')
  .version();

Or whatever user has entered while generating custom directories

Scaffolding inertia-react doesn't work

Describe the bug
I'm using cakephp-inertiajs:

bin/cake asset_mix generate inertia-react

Output:

Error: "inertia-react" is not a valid value for preset. Please use one of "bootstrap, vue, react, inertia-vue"

To Reproduce
Steps to reproduce the behavior:

  1. Install and load the plugin (I did through cakephp-inertiajs)
  2. Run bin/cake asset_mix generate inertia-react

Expected behavior
Scaffolded inertia-react app in assets directory.

Screenshots
Screen Shot 2021-03-18 at 1 29 57 PM

Not sure if this is related to cakephp-inertiajs (asset-mix not upgraded maybe), I didn't make a check yet.

Generate command

Develop new generate command to create below file/folders:

  1. webpack.mix.js file
  2. assets directory
  3. package.json

Also provide options to take name from user for assets directory, for example below command should generate assets folder:

bin/cake asset_mix generate --dir=resources

Using several apps

Hi,
in my project I've got several apps which are loaded into normal pages
ie: Pages/map.php -> will load map.js

Is there a way to compile different apps instead of only app.js

Thanks
Massimo

Unable to find assets with external cssBaseUrl and jsBaseUrl

Description

My assets are hosted on a CDN in production. According to the Cake Book the App.cssBaseUrl and App.jsBaseUrl should be the URL and path to the CDN. When I set App.jsBaseUrl to https://example.com/js/ I get the following error when trying to execute $this->AssetMix->script('app');:

Unable to locate AssetMix file: /https://example.com/js/app.js.

Steps To Reproduce

  1. Add the following lines to app_local.php. Combine the App array if one already exists.
    'App' => [
        'cssBaseUrl' => 'https://example.com/css/',`
        'jsBaseUrl' => 'https://example.com/js/',
    ]
  2. Compile javascript and CSS assets.
    mix.js('resources/js/app.js', 'webroot/js')
        .sass('resources/sass/main.scss', 'webroot/css');
  3. Add $this->AssetMix->js('app'); to a template file.

Expected behavior

The CSS file should load from https://example.com/css/main.css and the javascript should load from https://example.com/js/app.js.

Tests

I wrote these tests in case they would be useful.

/**
 * Test `css()` function returns proper url
 *
 * @return void
 */
public function testStyleTagWithExternalBaseUrl()
{
    Configure::write('App.cssBaseUrl', 'https://example.com/css/');

    $this->_copyWithoutVersion();

    $result = $this->AssetMix->css('main');

    $this->assertStringContainsString('https://example.com/css/main.css', $result);
}

/**
 * Test `script()` function returns proper url
 *
 * @return void
 */
public function testScriptTagWithExternalBaseUrl()
{
    Configure::write('App.jsBaseUrl', 'https://example.com/js/');

    $this->_copyWithoutVersion();

    $result = $this->AssetMix->script('app');

    $this->assertStringContainsString('https://example.com/js/app.js', $result);
}

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.