질문 창고/라라벨
이메일 전송된 페이지 css 적용
박주니
2022. 3. 22. 14:49
728x90
반응형
1. 먼저 config\mail.php 'markdown'에서 경로를 확인합니다. markdown에서 paths에는 현재 template 적용한 경로를 연결해주면 됩니다.
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/emails/TestMail'),
],
],
- 참고할 부분▶
- 'theme' => 'default'의 위치는 resource\views\vendor\mail\html\themes\default.css 이고 의미하는 것은 mail css가 현재 default.css에 연결되었다는 의미입니다.
- paths에 resource_path에 연결되어 있는 경로는 mail template 경로입니다.
2. php artisan vendor:publish --tag=laravel-mail 을 해서 laravel-mail publish를 자동적으로 실행할 수 있게 설정합니다.
php artisan vendor:publish --tag=laravel-mail
3. App\Mail\TestMail에 build class에서 view()를 markdown()으로 전환해주시길 바랍니다.
public function build()
{
return $this->subject('Test Mail From Surfside Media')->markdown('emails.TestMail');
}
4. npm run dev하고 해당 경로로 들어가서 실행을 하시면 됩니다.
질문사항▶
- 현재 상단에 내용처럼 하면 기존에 있었던 default.css는 적용이 되지만 프론트단위에서 class를 만들고 css 적용할 때 전환되지 않는 것을 볼 수 있습니다. 현재 연결 방법은 compile이 아닌 default.css에서 직접 가져와서 사용되는 것으로 확인이 되는데 어떻게 접근해야할까요? 바로 프론트에서 style을 기재하면 적용되는 것은 확인이 됩니다.