Skip to content

dan-leech/laravel-elixir-foundation-emails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Elixir Foundation Emails 2 Integration

This extension brings Foundation Emails 2 support to Laravel Elixir, version 6 and up.

Step 1: Install

npm install laravel-elixir-foundation-emails --save-dev

Step 2: Usage

The foundationEmails method may be used to compile email blade templates, sass, images into blade views.

elixir(function(mix) {
    mix.foundationEmails();
});

Default options are:

options = {
    sass: 'resources/assets/sass/emails/email.scss',
    source: 'resources/emails',
    views: 'resources/views/emails',
    images: 'resources/emails/images',
    imagesDist: 'public/images/emails',
    publicCss: 'public/css',
    compiled: 'resources/emails/dist'
};
  • `sass:` email.scss - compiled into email.css, saves to `compiled` and `publicCss`.
  • `source` blade emails folder before inky and inlining css
  • `views` destination - compiled templates for use in Laravel
  • `images` images folder before minifing
  • `imagesDist` images ready for use
  • `compiled` tmprorary folder

To choose a different options or rewrite one of them you can use method argument.

elixir(function(mix) {
    mix.foundationEmails({
        copiled: 'public/compiled/emails'
    });
});

Or can use foundation-emails.config.js file in your project root. Example:

module.exports = {
     sass: 'resources/assets/sass/emails/email.scss',
     source: 'resources/emails',
     views: 'resources/views/emails',
     images: 'resources/emails/images',
     imagesDist: 'public/images/emails',
     publicCss: 'public/css',
     compiled: 'resources/emails/dist'
};

Step 3: Plugins

If you've created a plugin, and need to hook your own FoundationEmails config into Elixir's defaults, add the following to your script:

Elixir.foundationEmails.mergeConfig({
sass: 'resources/assets/sass/emails/email.scss',
});

Elixir.foundationEmails.mergeConfig(newConfig) will recursively merge your provided configuration with ours.

Notices

Current plugin freezes gulp flow until all it's works will be done. Because I can't find better way to run several streams in elixir gulp task without callback.

Css inliner removes all <link rel="stylesheet" type="text/css" href="*"> tags in production mode. To add styles to compiled styles in head put it into <style type="text/css" media="screen"></style in head. You can add @font-face and etc. Or correct bugs in compiled styles. Supports blade syntax as well.

Releases

No releases published

Packages

No packages published