Skip to content

Commit

Permalink
chore: add css/less sourcemaps to local vite (#770)
Browse files Browse the repository at this point in the history
* chore: add css/less sourcemaps to local vite

* fix sourcemap paths
  • Loading branch information
braddialpad authored Dec 15, 2022
1 parent 58a53eb commit b2c23f3
Show file tree
Hide file tree
Showing 4 changed files with 471 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export default defineUserConfig({

bundler: viteBundler({
viteOptions: {
css: {
devSourcemap: true,
},
resolve: {
alias: {
vue$: 'vue/dist/vue.esm-bundler.js',
Expand Down
7 changes: 7 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const postcssResponsify = settings.styles
? require('@dialpad/postcss-responsive-variations')({ breakpoints, classes })
: null;
const postcssFocusVisible = settings.styles ? require('postcss-focus-visible') : null;
const sourcemaps = require('gulp-sourcemaps');

// @@ SVGS
const path = settings.svgs ? require('path') : null;
Expand Down Expand Up @@ -239,10 +240,16 @@ const libStylesDev = function (done) {
// Compile library files
return src(paths.styles.inputLib)
// compile less to css
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.mapSources(function (sourcePath, file) {
return '../../build/less/' + sourcePath;
}))
.pipe(sourcemaps.write())
.pipe(postcss([postcssResponsify, postcssFocusVisible]))
// concat the css into a single file
.pipe(concat('dialtone.css'))

.pipe(dest(paths.styles.outputLib));
};

Expand Down
Loading

0 comments on commit b2c23f3

Please sign in to comment.