Skip to content

Commit

Permalink
reduce file size by purging tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Sep 9, 2019
1 parent 1fb71d5 commit 06a1d11
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 10 deletions.
1 change: 0 additions & 1 deletion dist/js/tab.js

This file was deleted.

1 change: 1 addition & 0 deletions dist/tab.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/tab.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"devDependencies": {
"cross-env": "^5.0.0",
"laravel-mix": "^1.0",
"laravel-mix": "^2.0",
"laravel-mix-purgecss": "^1.0",
"prettier": "^1.14.0"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions resources/js/components/Tab.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="tab-content">
<div id="astrotomic-stackoverflow-tab" class="tab-content">
<div class="layout-col py-2">

<div class="my-2">
Expand Down Expand Up @@ -154,5 +154,4 @@
</script>

<style scoped>
@import "../../../node_modules/tailwindcss/dist/utilities.css";
</style>
3 changes: 3 additions & 0 deletions resources/sass/tab.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#astrotomic-stackoverflow-tab {
@import "~tailwindcss/dist/utilities";
}
3 changes: 2 additions & 1 deletion src/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function component(): string

public function registerAssets(): void
{
$this->script($this->component(), __DIR__.'/../dist/js/tab.js');
$this->script($this->component(), __DIR__.'/../dist/tab.js');
$this->style($this->component(), __DIR__.'/../dist/tab.css');
}
}
7 changes: 4 additions & 3 deletions tests/TabTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ public function it_has_the_correct_scripts(): void
$tab = new Tab();

$this->assertArrayHasKey('ignition-stackoverflow', $tab->scripts);
$this->assertStringEndsWith('dist/js/tab.js', $tab->scripts['ignition-stackoverflow']);
$this->assertStringEndsWith('dist/tab.js', $tab->scripts['ignition-stackoverflow']);
}

/** @test */
public function it_has_no_styles(): void
public function it_has_the_correct_styles(): void
{
$tab = new Tab();

$this->assertEmpty($tab->styles);
$this->assertArrayHasKey('ignition-stackoverflow', $tab->styles);
$this->assertStringEndsWith('dist/tab.css', $tab->styles['ignition-stackoverflow']);
}
}
13 changes: 11 additions & 2 deletions webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
const mix = require('laravel-mix')
const mix = require('laravel-mix');
require('laravel-mix-purgecss');

mix.js('resources/js/tab.js', 'dist/js');
mix
.setPublicPath('dist')
.js('resources/js/tab.js', '')
.sass('resources/sass/tab.scss', '')
.options({
processCssUrls: false,
})
.purgeCss()
;

0 comments on commit 06a1d11

Please sign in to comment.