let mix = require('laravel-mix'); let build = require('./tasks/build.js'); let tailwindcss = require('tailwindcss'); mix.disableSuccessNotifications(); mix.setPublicPath('source/assets/build'); mix.webpackConfig({ plugins: [ build.jigsaw, build.browserSync(), build.watch([ 'source/**/*.md', 'source/**/*.php', 'source/**/*.scss', '!source/**/_tmp/*', 'config.php', 'config.production.php' ]), ] }); mix.js('source/_assets/js/main.js', 'js') .sass('source/_assets/sass/main.scss', 'css') .options({ processCssUrls: false, postCss: [ tailwindcss('./tailwind.js') ], }).version();
// Load UI config const configPath = './config/ui.yml'; let config; try { config = yaml.safeLoad(fs.readFileSync(configPath, 'utf8')); } catch (e) { throw new Error(`Failed to load ${configPath}: ${e}`); } /** * -------------------------------------------------------------------------- * Mix Asset Management * -------------------------------------------------------------------------- * * Mix provides a clean, fluent API for defining some Webpack build steps * for your Laravel application. By default, we are compiling the Sass * file for the application as well as bundling up all the JS files. */ mix.js('resources/js/app.js', 'public/js').sass('resources/sass/app.scss', 'public/css', { data: Object.entries(flat(config, { delimiter: '-' })) .map(([name, value]) => `$${name}: ${value};\n`) .join(''), }); if (mix.inProduction()) { mix.version(); } else { mix.webpackConfig({ devtool: 'inline-source-map' }).sourceMaps(); }
let mix = require('laravel-mix'); let build = require('./tasks/build.js'); let tailwindcss = require('tailwindcss'); require('laravel-mix-purgecss'); mix.disableSuccessNotifications(); mix.setPublicPath('source/assets/build/'); mix.webpackConfig({ plugins: [ build.jigsaw, build.browserSync(), build.watch([ 'config.php', 'source/**/*.md', 'source/**/*.php', 'source/**/*.scss', ]), ], }); mix.js('source/_assets/js/main.js', 'js') .sourceMaps() .sass('source/_assets/sass/main.scss', 'css/main.css') .sourceMaps() .options({ processCssUrls: false }) .purgeCss({ extensions: ['html', 'md', 'js', 'php', 'vue'], folders: ['source'], whitelistPatterns: [/language/, /hljs/],
.sass(`${config.paths.assets}/${config.sass}`, `${config.paths.build}/styles/`) .copy(`${config.paths.assets}/images/**/*.{png,jpg,jpeg,gif,svg,ico}`, `${config.paths.build}/images`, false) .copy(`${config.paths.assets}/fonts/**/*.{eot,svg,ttf,otf,woff,woff2}`, `${config.paths.build}/fonts`, false); mix.options({ // processCssUrls: false, vue: { esModule: true }, // extractVueStyles: `${config.paths.build}/${config.vue_css}` // Path or boolean // globalVueStyles: file, // Variables file to be imported in every component. }); if (mix.inProduction()) { // Hash and version files in production. mix.version(); // need to add cb to theme's php page } else { mix.webpackConfig({ devtool: 'inline-source-map', }); // Source maps when not in production. mix.sourceMaps() // .browserSync(config.serve); .browserSync({ proxy: proxy_url, files: config.serve.files }); }
mix.webpackConfig({ resolve: { alias: { '@': path.resolve('frontend/js'), 'styles': path.resolve('frontend/scss') } }, plugins: [ new webpack.optimize.CommonsChunkPlugin({ name: 'assets/admin/js/vendor', minChunks: function (module) { // This prevents stylesheet resources with these extensions // from being moved from their original chunk to the vendor chunk if (module.resource && (/^.*\.(css|scss|less)$/).test(module.resource)) { return false } return module.context && module.context.indexOf('node_modules') !== -1 } }), new webpack.optimize.CommonsChunkPlugin({ name: 'assets/admin/js/manifest', minChunks: Infinity }) ], module: { rules: [ { test: /\.(js|vue)$/, exclude: /node_modules/, loader: 'eslint-loader', enforce: 'pre', include: [path.resolve('frontend/js')], options: { formatter: require('eslint-friendly-formatter') } } ] } })
const mix = require('laravel-mix'); mix.webpackConfig({ output: { library: 'FuzzySearch', libraryTarget: 'umd', libraryExport: 'default', globalObject: "(typeof window !== 'undefined' ? window : this)", }, }).js('src/FuzzySearch.js', 'dist/');
'axios', 'vuex', 'jquery', 'popper.js', 'vue-i18n', 'vue-meta', 'js-cookie', 'bootstrap', 'vue-router', 'sweetalert2', 'vuex-router-sync' ]) } mix.webpackConfig({ plugins: [ // new BundleAnalyzerPlugin(), new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery', Popper: ['popper.js', 'default'] }) ], resolve: { alias: { '~': path.join(__dirname, './resources/assets/js') } } })
nodeDir + 'admin-lte/dist/js/app.min.js', nodeDir + 'raphael/raphael.min.js', nodeDir + 'nestable-fork/dist/jquery.nestable.min.js', composerDir + 'yajra/laravel-datatables-buttons/src/resources/assets/buttons.server-side.js', assetsDir + 'js/admin.js' ], applicationJs = [ assetsDir + 'js/application.js', nodeDir + 'jquery-floating-social-share/dist/jquery.floating-social-share.min.js', ]; // If you try to do it with the Laravel Mix's copy function then, // you will end up with all tinymce files stored within a folder where plugins will fail // https://stackoverflow.com/questions/30522896/how-to-shim-tinymce-in-webpack mix.webpackConfig({ plugins: [ new copyWebpackPlugin([ { from: nodeDir + 'tinymce', to: 'packages/tinymce' }, { from: assetsDir + 'other/tinymce-localautosave', to: 'packages/tinymce/plugins/localautosave' }, ]) ] }); mix .copy(nodeDir + 'font-awesome/fonts', publicDir + 'fonts') .copy(nodeDir + 'bootstrap/fonts', publicDir + 'fonts') .less(assetsDir + 'less/admin.less', distDir + 'css/admin.css').version() .less(assetsDir + 'less/application.less', distDir + 'css/application.css').version() .combine(adminJs, distDir + 'js/admin.js') .js(applicationJs, distDir +'js/application.js').version();
mix.options({ extractVueStyles: true, globalVueStyles: `./front-end/sass/globals.sass`, // uglify: { // uglifyOptions: { // compress: { // drop_console: mix.inProduction(), // }, // }, // }, }); mix.copy('front-end/static/', 'dashboard/'); if (!mix.inProduction()) { mix.webpackConfig({ devtool: `inline-source-map` }); const Config = require('./back-end/config/Config'); mix.browserSync({ proxy: `localhost:${Config.getServerPort()}`, injectChanges: false, files: [`dashboard/**/*`], }); mix.disableSuccessNotifications(); } mix.version(); mix.setPublicPath(`dashboard/`);
'public/css/main.css'], 'public/css/main.min.css' ) ; mix.webpackConfig({ plugins: [ new BrowserSyncPlugin({ host: 'localhost', port: 3000, files: ['public/*.html', 'public/css/*.css', 'public/js/*.js'], server: { baseDir: ['public'] } }), new CopyWebpackPlugin([{ from: 'src/img', to: 'public/img', }]), new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i, pngquant: { quality: '65-80' }, plugins: [ imageminMozjpeg({ quality: 65, }) ] }) ] });
|-------------------------------------------------------------------------- | | Mix provides a clean, fluent API for defining some Webpack build steps | for your Laravel application. By default, we are compiling the Sass | file for the application as well as bundling up all the JS files. | */ mix.webpackConfig({ plugins: [ // Ignore all locale files of moment.js // new webpack.IgnorePlugin( // /^\.\/locale$/, /moment$/, // /^\.\/locale$/, /fullcalendar$/ // ) new webpack.ContextReplacementPlugin( // The path to directory which should be handled by this plugin /moment[\/\\]locale/, /fullcalendar[\/\\]dist[\/\\]locale/, /select2[\/\\]dist[\/\\]js[\/\\]i18n/, ) ] }); mix.js('resources/assets/backend/js/app.js', 'public/js') .js([ 'resources/assets/backend/js/site-dashboard.js', ], 'public/js/site-dashboard.js') .js([ 'resources/assets/backend/js/dashboard.js', ], 'public/js/dashboard.js')
* Compile js and scss */ // mix.js('resources/assets/js/asgardcms.js', 'assets/js/asgardcms.js'); // mix.sass('resources/assets/scss/asgardcms.scss', 'assets/css/asgardcms.css'); /** * Copy node module */ mix.copyDirectory('node_modules/admin-lte', 'assets/vendor/admin-lte'); // mix.copyDirectory('node_modules/animate.css', 'assets/vendor/animate.css'); // mix.copyDirectory('node_modules/bootstrap', 'assets/vendor/bootstrap'); // mix.copyDirectory('node_modules/clipboard', 'assets/vendor/clipboard'); // mix.copyDirectory('node_modules/datatables.net', 'assets/vendor/datatables.net'); // mix.copyDirectory('node_modules/datatables.net-bs', 'assets/vendor/datatables.net-bs'); mix.copyDirectory('node_modules/font-awesome', 'assets/vendor/font-awesome'); // mix.copyDirectory('node_modules/gridstack', 'assets/vendor/gridstack'); // mix.copyDirectory('node_modules/icheck', 'assets/vendor/iCheck'); // mix.copyDirectory('node_modules/jquery', 'assets/vendor/jquery'); // mix.copyDirectory('node_modules/jquery-ui', 'assets/vendor/jquery-ui'); // mix.copyDirectory('node_modules/lodash', 'assets/vendor/lodash'); // mix.copyDirectory('node_modules/simplemde/src', 'assets/vendor/simplemde/src'); /** * Publishing the assets */ mix.webpackConfig({ plugins: [ new WebpackShellPlugin({ onBuildEnd: [`php ../../artisan stylist:publish ${themeInfo.name}`] }), ], });