kisstkondoros / gutter-preview

Other
158 stars 37 forks source link

mapping paths and alias #135

Closed Minori-ty closed 1 year ago

Minori-ty commented 2 years ago

first, replace "@" with "$" second, use "$xxx"

for example

    "gutterpreview.paths": {
        "$src": "${workspaceFolder}/src"
    },

then,you can use the alias for html

   <img src="src/assets/logo.png" alt="" />
   <img src="$src/assets/logo.png" alt="" />

image

Minori-ty commented 2 years ago

but how can I use the alias with "@"? It don't work :(

dusionlike commented 2 years ago

Are you windows system? If yes, #138 may be able to help you. I released an interim version, you can try this. then setting.json

"gutterpreview.paths": {
    "@": "./src"
},

or tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
mxp131011 commented 2 years ago

Are you windows system? If yes, #138 may be able to help you. I released an interim version, you can try this. then setting.json

"gutterpreview.paths": {
    "@": "./src"
},

or tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

jsconfig.json is unsuccessful, but tsconfig.json is succeed

mxp131011 commented 2 years ago

'gutterpreview.paths' can also

Minori-ty commented 1 year ago

Are you windows system? If yes, #138 may be able to help you. I released an interim version, you can try this. then setting.json

"gutterpreview.paths": {
    "@": "./src"
},

or tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

It's useful, thank you! But it don‘t work by start with '/@/', and vben's alias is start with '/@/', could you resolve this problem? please~ image

Vsnoy commented 1 year ago

Are you windows system? If yes, #138 may be able to help you. I released an interim version, you can try this. then setting.json

"gutterpreview.paths": {
    "@": "./src"
},

or tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

thanks,it works for me.

xiangdongbu commented 1 year ago

"@": "./src"

image

"gutterpreview.paths": {
    "@": "./src"
},

It doesn't work