vue2-google-maps custom styles - vue.js

<template>
<gmap-map
:center="center"
:zoom="11"
:options="mapStyle"
style="height: 60vh;"
>
<gmap-marker
:key="index"
v-for="(m, index) in markers"
:position="m.position"
:clickable="true"
:draggable="true"
#click="center=m.position">
</gmap-marker>
</gmap-map>
</template>
import * as VueGoogleMaps from 'vue2-google-maps';
import Vue from 'vue';
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyB3Dll79BdxJTlWtovrOnP2Vx4IUlSOlGg'
},
});
export default {
data() {
return {
center: {lat: 40.731266336572205 , lng: -73.99026142354683},
markers: [
{
position: {lat: 40.731266336572205 , lng: -73.99026142354683},
}],
};
},
};
On my page I will use Google Maps. That's no problem and this code works, but is this possible to set custom colors on the map? Let's say like here: enter link description here. With Google Maps JavaScript this is very simple but how to get the same effect with vue2-Google-maps?? Some props or something?

In fact It should be pretty easy.Just extend your mapStyle object with following property (pasting one from Maps page):
data: {
mapStyle: {
// other properties...
styles: [
{elementType: 'geometry', stylers: [{color: '#242f3e'}]},
{elementType: 'labels.text.stroke', stylers: [{color: '#242f3e'}]},
{elementType: 'labels.text.fill', stylers: [{color: '#746855'}]},
{
featureType: 'administrative.locality',
elementType: 'labels.text.fill',
stylers: [{color: '#d59563'}]
},
{
featureType: 'poi',
elementType: 'labels.text.fill',
stylers: [{color: '#d59563'}]
},
{
featureType: 'poi.park',
elementType: 'geometry',
stylers: [{color: '#263c3f'}]
},
{
featureType: 'poi.park',
elementType: 'labels.text.fill',
stylers: [{color: '#6b9a76'}]
},
{
featureType: 'road',
elementType: 'geometry',
stylers: [{color: '#38414e'}]
},
{
featureType: 'road',
elementType: 'geometry.stroke',
stylers: [{color: '#212a37'}]
},
{
featureType: 'road',
elementType: 'labels.text.fill',
stylers: [{color: '#9ca5b3'}]
},
{
featureType: 'road.highway',
elementType: 'geometry',
stylers: [{color: '#746855'}]
},
{
featureType: 'road.highway',
elementType: 'geometry.stroke',
stylers: [{color: '#1f2835'}]
},
{
featureType: 'road.highway',
elementType: 'labels.text.fill',
stylers: [{color: '#f3d19c'}]
},
{
featureType: 'transit',
elementType: 'geometry',
stylers: [{color: '#2f3948'}]
},
{
featureType: 'transit.station',
elementType: 'labels.text.fill',
stylers: [{color: '#d59563'}]
},
{
featureType: 'water',
elementType: 'geometry',
stylers: [{color: '#17263c'}]
},
{
featureType: 'water',
elementType: 'labels.text.fill',
stylers: [{color: '#515c6d'}]
},
{
featureType: 'water',
elementType: 'labels.text.stroke',
stylers: [{color: '#17263c'}]
}
]
}
}

Related

SQL update in JSON

I'm having trouble updating a JSON object, which is represented as an object rather than an array. I need to dynamically bypass all the keys, but they have a random number in their name, which can be absolutely anything (there is no way to change the JSON view) and get to the visibility to change its value. For example:
Set the visibility to false for all bicycle keys
{
"objects": {
"object1": {
"components": {
"car": { "visibility": true},
"bicycle": { "visibility": true},
"bicycle1": { "visibility": true},
"bicycle2": { "visibility": true},
"van": { "visibility": true}
}
},
"object2": {
"components": {
"car": { "visibility": true},
"bicycle5": { "visibility": true},
"van": { "visibility": true}
}
}
},
"objectN": {
"components": {
"car": { "visibility": true},
"bicycle": { "visibility": true},
"bicycle3": { "visibility": true},
"van": { "visibility": true}
}
}
}
}
Result JSON
{
"objects": {
"object1": {
"components": {
"car": { "visibility": true},
"bicycle": { "visibility": false},
"bicycle1": { "visibility": false},
"bicycle2": { "visibility": false},
"van": { "visibility": true}
}
},
"object2": {
"components": {
"bicycle5": { "visibility": false},
"van": { "visibility": true}
}
}
},
"objectN": {
"components": {
"car": { "visibility": true},
"bicycle": { "visibility": false},
"bicycle3": { "visibility": false},
"van": { "visibility": true}
}
}
}
}
I have attempted to use JSON_MODIFY and OPEN_JSON, but as I am new to SQL, I am having trouble. I would appreciate any help or suggestions.

Google Map Styles cannot finding Parking Lots

I am using the Maps Javascript API and styling it. The map loads fine with no errors and styles all the points of interests except for one. I have not been able to find a way that styles parking lots(paid parking/underground parking/building parking/sports complex parking).
I've used just about every option that is listed in the reference table and am not able to featureType that will make it work. I also used the google map styler to create a custom map style but not one of the feature type options will change the parking lot style.
This is the code that I am using to style the map...
const styles = {
default: [],
hide: [
{
featureType: "all",
elementType: "labels.text.fill",
stylers: [
{
"saturation": 100
},
{
"color": "#999999" /* e944e9 */
},
{
"lightness": 15
}
]
},
{
featureType: "all",
elementType: "labels.text.stroke",
stylers: [
{
"visibility": "on"
},
{
"color": "#000000"
},
{
"lightness": 0
}
]
},
{
featureType: "all",
elementType: "labels.icon",
stylers: [
{
"visibility": "off"
}
]
},
{
featureType: "administrative",
elementType: "geometry.fill",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi.park",
elementType: "geometry.fill",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi.school",
elementType: "geometry.fill",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi.medical",
elementType: "geometry.fill",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "administrative",
elementType: "geometry.stroke",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 10
},
{
"weight": 1.2
}
]
},
{
featureType: "administrative.neighborhood",
elementType: "geometry.stroke",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 100
},
{
"weight": 1.2
}
]
},
{
featureType: "poi.sports_complex",
elementType: "geometry",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "landscape",
elementType: "geometry",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "road.arterial",
elementType: "geometry.fill",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "road.arterial",
elementType: "geometry.stroke",
stylers: [
{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi",
elementType: "geometry",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 21
}
]
},
{
featureType: "poi",
elementType: "geometry.fill",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 8
},
{
"weight": 1
}
]
},
{
featureType: "poi",
elementType: "geometry.stroke",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 8
},
{
"weight": 100
}
]
},
{
featureType: "road.highway",
elementType: "geometry.fill",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "road.highway",
elementType: "geometry.stroke",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 8
},
{
"weight": 0.2
}
]
},
{
featureType: "road.arterial",
elementType: "geometry",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "road.local",
elementType: "geometry",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "transit",
elementType: "geometry",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "water",
elementType: "geometry",
stylers: [
{
"color": "#220a4b"
},
{
"lightness": 1
}
]
},
{
featureType: "poi.business",
stylers: [{ "visibility": "off" }],
},
{
featureType: "poi.government",
elementType: "labels.icon",
stylers: [{ "visibility": "off" }],
},
{
featureType: "poi.medical",
elementType: "labels.icon",
stylers: [{ "visibility": "off" }],
},
{
featureType: "poi.place_of_worship",
stylers: [{ "visibility": "off" }],
},
{
featureType: "poi.park",
elementType: "labels.icon",
stylers: [{ "visibility": "off" }],
},
{
featureType: "transit.station.bus",
elementType: "labels.icon",
stylers: [{ "visibility": "on" }],
},
{
featureType: "transit.line",
elementType: "labels.icon",
stylers: [{ "visibility": "off" }],
},
],
There doesn't seem to be a way to target parking for styling (not everything can be targeted directly).
You could try creating a feature request.
Another option would be to query the places service for parking lots in the area and display those with your own custom icons or create your own data for the parking areas you want to display.
proof of concept fiddle
code snippet:
let map;
let infowindow;
function initMap() {
infowindow = new google.maps.InfoWindow();
// Styles a map.
map = new google.maps.Map(document.getElementById("map"), {
center: {
lat: 32.7169289,
lng: -117.1657514
},
zoom: 16,
styles: [{
featureType: "all",
elementType: "labels.text.fill",
stylers: [{
"saturation": 100
},
{
"color": "#999999" /* e944e9 */
},
{
"lightness": 15
}
]
},
{
featureType: "all",
elementType: "labels.text.stroke",
stylers: [{
"visibility": "on"
},
{
"color": "#000000"
},
{
"lightness": 0
}
]
},
{
featureType: "all",
elementType: "labels.icon",
stylers: [{
"visibility": "off"
}]
},
{
featureType: "administrative",
elementType: "geometry.fill",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi.park",
elementType: "geometry.fill",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi.school",
elementType: "geometry.fill",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi.medical",
elementType: "geometry.fill",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "administrative",
elementType: "geometry.stroke",
stylers: [{
"color": "#260f50"
},
{
"lightness": 10
},
{
"weight": 1.2
}
]
},
{
featureType: "administrative.neighborhood",
elementType: "geometry.stroke",
stylers: [{
"color": "#260f50"
},
{
"lightness": 100
},
{
"weight": 1.2
}
]
},
{
featureType: "poi.sports_complex",
elementType: "geometry",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "landscape",
elementType: "geometry",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "road.arterial",
elementType: "geometry.fill",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "road.arterial",
elementType: "geometry.stroke",
stylers: [{
"color": "#260f50"
},
{
"lightness": 0
}
]
},
{
featureType: "poi",
elementType: "geometry",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 21
}
]
},
{
featureType: "poi",
elementType: "geometry.fill",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 8
},
{
"weight": 1
}
]
},
{
featureType: "poi",
elementType: "geometry.stroke",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 8
},
{
"weight": 100
}
]
},
{
featureType: "road.highway",
elementType: "geometry.fill",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "road.highway",
elementType: "geometry.stroke",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 8
},
{
"weight": 0.2
}
]
},
{
featureType: "road.arterial",
elementType: "geometry",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "road.local",
elementType: "geometry",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "transit",
elementType: "geometry",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 8
}
]
},
{
featureType: "water",
elementType: "geometry",
stylers: [{
"color": "#220a4b"
},
{
"lightness": 1
}
]
},
{
featureType: "poi.business",
stylers: [{
"visibility": "off"
}],
},
{
featureType: "poi.government",
elementType: "labels.icon",
stylers: [{
"visibility": "off"
}],
},
{
featureType: "poi.medical",
elementType: "labels.icon",
stylers: [{
"visibility": "off"
}],
},
{
featureType: "poi.place_of_worship",
stylers: [{
"visibility": "off"
}],
},
{
featureType: "poi.park",
elementType: "labels.icon",
stylers: [{
"visibility": "off"
}],
},
{
featureType: "transit.station.bus",
elementType: "labels.icon",
stylers: [{
"visibility": "on"
}],
},
{
featureType: "transit.line",
elementType: "labels.icon",
stylers: [{
"visibility": "off"
}],
},
],
});
service = new google.maps.places.PlacesService(map);
var request = {
location: map.getCenter(),
keyword: "parking",
radius: '1000',
type: ['parking']
};
service.nearbySearch(request, callback);
}
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
console.log("results=" + results.length + " status=" + status)
for (var i = 0; i < results.length; i++) {
console.log("[" + i + "] name=" + results[i].name + " location=" + results[i].geometry.location.toUrlValue(6));
createMarker(results[i]);
}
}
}
function createMarker(place) {
if (!place.geometry || !place.geometry.location) return;
const marker = new google.maps.Marker({
map,
position: place.geometry.location,
title: place.name,
label: "P"
});
google.maps.event.addListener(marker, "click", () => {
infowindow.setContent(place.name || "");
infowindow.open(map, marker);
});
}
window.initMap = initMap;
#map {
height: 100%;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
<!DOCTYPE html>
<html>
<head>
<title>Styled Maps - Night Mode</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<!-- jsFiddle will insert css and js -->
</head>
<body>
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap&v=weekly&libraries=places" defer></script>
</body>
</html>

react-native-maps custom map style

I created a json using google maps styling wizard. I then set that to a const under render and set that const to my MapView style but it renderers nothing when I do.
I am not sure the issue, Ideally I would like to have the style in a separate file but I was trying to start small.
How can I fix the current issue I am having as well as import and use the style from a separate file?
Here is a snack of my code that reproduces my exact error as well as the code below.
export default class Map extends React.Component {
render() {
const mapStyle = [
{
"featureType": "landscape.man_made",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.attraction",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.business",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.business",
"elementType": "labels.text",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "poi.government",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
}
]
return (
<View style={{...StyleSheet.absoluteFillObject}}>
<MapView
style={mapStyle}
provider={PROVIDER_GOOGLE}>
</MapView>
</View>
);
}
}
The custom google maps styling must be passed to the customMapStyle prop and you need to set a specific width and height in the normal style prop of the MapView. Setting absoluteFillObject does something different than you might have thought and according to the react-native documentation there is
Currently, there is no difference between using absoluteFill vs. absoluteFillObject.
Thus, absoluteFill is for the following use case.
A very common pattern is to create overlays with position absolute and zero positioning (position: 'absolute', left: 0, right: 0, top: 0, bottom: 0), so absoluteFill can be used for convenience and to reduce duplication of these repeated styles.
This will not set a height and a width! We need to do this manually which is documented here.
The following solves your problem.
const styles = ScaledSheet.create({
map: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
...
The JSX component.
return (
<View style={{...StyleSheet.absoluteFillObject}}>
<MapView
style={styles.map}
customMapStyle={mapStyle}
provider={PROVIDER_GOOGLE}>
</MapView>
</View>
);
Here is the full solution.
export default class Map extends React.Component {
render() {
const mapStyle = [
{
"featureType": "landscape.man_made",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.attraction",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.business",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.business",
"elementType": "labels.text",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "poi.government",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
}
]
return (
<View style={{...StyleSheet.absoluteFillObject}}>
<MapView
style={styles.map}
customMapStyle={mapStyle}
provider={PROVIDER_GOOGLE}>
</MapView>
</View>
);
}
}
const styles = ScaledSheet.create({
map: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
bubble: {
justifyContent: 'center',
alignItems: 'center',
padding: 15,
},
carousel: {
position: 'absolute',
top: scale(625)
},
cardContainer: {
backgroundColor: '#d1cfcf',
height: scale(40),
width: scale(300),
borderRadius: 10,
alignSelf: 'center',
alignItems: 'center',
justifyContent: 'center',
},
name: {
color: 'black',
fontSize: 22,
}
});
Defining the customMapStyle in a separate file is plain JS and can be done as follows.
Define a new file, named CustomMapStyle.js and add the following content.
export const CustomMapStyle = [
{
"featureType": "landscape.man_made",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.attraction",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.business",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "poi.business",
"elementType": "labels.text",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "poi.government",
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
}
]
Then use it as follows.
import {CustomMapStyle} from './CustomMapStyle'
...
render() {
return (
<View style={{...StyleSheet.absoluteFillObject}}>
<MapView
style={styles.map}
customMapStyle={CustomMapStyle}
provider={PROVIDER_GOOGLE}>
</MapView>
</View>
);
}
I have updated your snack here.
The final result.

Nuxt Hot reloading for new components Is not working

Nuxt hot reloading somehow works for old components, but any new components that I have created today, doesn't seem to be watched by the app, and doesn't reload. I have to restart the app each time to see the changes applied to these new files.
The machine that I am using is MacOs latest Mojave system.
I realized people might ask for the package.json file so here is the file
{
"name": "theta",
"version": "1.0.0",
"description": "My fabulous Nuxt.js project",
"private": true,
"scripts": {
"dev": "NUXT_HOST=0.0.0.0 NUXT_PORT=3333 nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"devHttps": "node server/index.js"
},
"dependencies": {
"#clampy-js/vue-clampy": "^1.0.6",
"#fortawesome/free-brands-svg-icons": "^5.9.0",
"#fortawesome/free-solid-svg-icons": "^5.9.0",
"#nuxtjs/auth": "^4.7.0",
"#nuxtjs/axios": "^5.5.4",
"#nuxtjs/component-cache": "^1.1.5",
"#nuxtjs/dotenv": "^1.3.0",
"#nuxtjs/google-adsense": "^1.1.3",
"#nuxtjs/google-analytics": "^2.2.0",
"#nuxtjs/moment": "^1.2.0",
"#nuxtjs/pwa": "^2.6.0",
"#nuxtjs/robots": "^2.2.0",
"#nuxtjs/style-resources": "^0.1.2",
"#nuxtjs/svg-sprite": "^0.2.1",
"#nuxtjs/toast": "^3.2.1",
"#nuxtjs/vuetify": "^0.5.6",
"#sum.cumo/nuxt-styleguide": "^5.3.0",
"atob": "^2.1.2",
"axios": "^0.19.0",
"browserslist": "^4.6.2",
"caniuse-lite": "^1.0.30000974",
"chart.js": "^2.8.0",
"cookie": "^0.3.1",
"cookie-parser": "^1.4.4",
"cookie-universal-nuxt": "^2.0.16",
"cross-env": "^5.2.0",
"echarts": "^4.2.1",
"element-ui": "^2.9.1",
"epic-spinners": "^1.1.0",
"fstream": "^1.0.12",
"imagemagick": "^0.1.3",
"intersection-observer": "^0.5.1",
"js-yaml": "^3.13.1",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.11",
"lodash-es": "^4.17.11",
"moment": "^2.24.0",
"nuxt": "^2.8.1",
"nuxt-compress": "^1.0.2",
"nuxt-device-detect": "^1.1.5",
"nuxt-fontawesome": "^0.4.0",
"nuxt-stripe-module": "^2.0.0",
"nuxt-universal-storage": "^0.2.0",
"nuxt-validate": "^0.1.3",
"nuxt-webfontloader": "^1.1.0",
"swiper": "^4.5.0",
"tar": "^4.4.10",
"tb-skeleton": "^0.3.6",
"uuid": "^3.3.2",
"v-charts": "^1.19.0",
"v-click-outside-x": "^3.7.1",
"vee-validate": "^2.2.10",
"vue": "^2.6.10",
"vue-avatar-editor-improved": "^1.0.4",
"vue-awesome-swiper": "^3.1.3",
"vue-chartjs": "^3.4.2",
"vue-clamp": "^0.2.1",
"vue-count-to": "^1.0.13",
"vue-croppa": "^1.3.8",
"vue-infinite-loading": "^2.4.4",
"vue-line-clamp": "^1.3.2",
"vue-loaders": "^2.0.0",
"vue-match-media": "^1.0.3",
"vue-scrollama": "^1.1.1",
"vue-scroller": "^2.2.4",
"vue-scrollto": "^2.15.0",
"vue-server-renderer": "^2.6.10",
"vue-swipe-tab": "^2.0.4",
"vue-template-compiler": "^2.6.10",
"vue-text-dot": "^1.0.0",
"vue-the-mask": "^0.11.1",
"vue-tiny-lazyload-img": "^0.1.0",
"vue-truncate-collapsed": "^2.1.0",
"vue-zondicons": "^0.1.10",
"vue2-datepicker": "^2.11.2",
"vue2-editor": "^2.8.1",
"vue2-touch-events": "^1.1.2",
"vuetify-loader": "^1.2.2",
"vuetify-upload-button": "^1.2.2",
"vuex-router-sync": "^5.0.0"
},
"devDependencies": {
"autoprefixer": "^9.6.0",
"css-loader": "^2.1.1",
"moment-locales-webpack-plugin": "^1.0.7",
"node-sass": "^4.12.0",
"nodemon": "^1.19.1",
"postcss-gap-properties": "^2.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2"
}
}
Here is my nuxt config file
const pkg = require('./package')
const webpack = require('webpack')
require('dotenv').config()
module.exports = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: 'ノーブル',
meta: [{
charset: 'utf-8'
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1,minimum-scale=1, maximum-scale=1'
},
{
hid: 'description',
name: 'description',
content: '小説家・読者のプラットフォーム'
}
],
link: [{
rel: 'icon',
type: 'image/x-icon',
href: '/favicon.ico'
}],
script: [{
src: '/js/fb-sdk.js'
}, {
src: '/js/gg-sdk.js'
}]
},
/*
** Customize the progress-bar color
*/
loading: {
color: '#af9bd0',
height: '3px',
continuous: true
},
generate: {
routes: [
'/ads.txt',
]
},
/*
** Global CSS
*/
css: [
'element-ui/lib/theme-chalk/index.css',
'swiper/dist/css/swiper.css',
"assets/css/index.css",
"assets/css/main.scss",
'vue-loaders/dist/vue-loaders.css'
],
/*
** Plugins to load before mounting the App
*/
plugins: [
'#/plugins/element-ui',
'#/plugins/intercept',
{
src: '~plugins/vue-star-rating',
ssr: false
},
{
src: '~/plugins/swiper',
ssr: false
},
{
src: '~/plugins/intercept',
ssr: false
},
{
ssr: false,
src: '~/plugins/avatar'
},
{
ssr: false,
src: "~plugins/clickOutside"
}, {
ssr: false,
src: "~plugins/vueEditor"
}, {
src: '#/plugins/vueMask',
ssr: false
}, {
src: '#/plugins/zondiIcon',
ssr: false
}, {
src: '#/plugins/elementLoading',
ssr: false
}, {
src: '#/plugins/vue-swipe-tab',
ssr: false
},
{
src: '#/plugins/pull-to',
ssr: false
},
{
src: '#/plugins/datePicker',
ssr: false
}, {
src: '#/plugins/vuelineclamp',
ssr: false
}, {
src: '#/plugins/graphs',
ssr: false
}, {
src: '#/plugins/infinite',
ssr: false
}, {
src: '#/plugins/vueClamp',
ssr: false
}, {
src: '#/plugins/watchMedia',
ssr: false
}, {
src: '#/plugins/scrollama',
ssr: false
}, {
src: '#/plugins/countTo',
ssr: false
}, {
src: '#/plugins/chartLine',
ssr: false
}, {
src: '#/plugins/skeleton',
ssr: false
}, {
src: '#/plugins/gAuth',
ssr: false,
}, {
src: '#/plugins/epicSpinners',
ssr: false,
},
{
src: '#/plugins/auth',
}
],
/*
** Nuxt.js modules
*/
modules: [
['#nuxtjs/vuetify', {
treeShake: true
}],
'#nuxtjs/pwa',
'nuxt-device-detect',
'nuxt-webfontloader',
'#nuxtjs/axios',
'#nuxtjs/dotenv',
'#nuxtjs/svg-sprite',
'#nuxtjs/style-resources',
['nuxt-validate', {
lang: 'ja',
}],
['#nuxtjs/robots', {
UserAgent: '*',
Disallow: '/',
UserAgent: 'Googlebot',
Disallow: '',
UserAgent: 'Yahoo-slurp',
Disallow: '',
UserAgent: 'Msnbot',
Disallow: ''
}],
['#nuxtjs/moment', {
locales: ['ja'],
defaultLocale: 'ja'
}],
['#nuxtjs/component-cache', {
maxAge: 1000 * 60 * 60
}],
['#nuxtjs/google-adsense', {
id: 'pub-4438410171989811'
}],
'cookie-universal-nuxt',
['nuxt-fontawesome', {
component: 'fa',
imports: [{
set: '#fortawesome/free-solid-svg-icons',
icons: ['fas']
}, {
set: '#fortawesome/free-brands-svg-icons',
icons: ['fab']
}]
}],
['#nuxtjs/google-analytics', {
id: 'UA-119733183-2',
autoTracking: {
page: false
}
}],
['nuxt-universal-storage', {
storage: {
vuex: true, // boolean or {namespace}
localStorage: true, // boolean or {prefix }
cookie: true, // boolean or {prefix, options }
initialState: {}, // Object {}
ignoreExceptions: true //
}
}],
['#nuxtjs/dotenv', {
/* module options */
}],
['#nuxtjs/toast', {
position: 'top-right',
duration: 5000
}],
['nuxt-stripe-module', {
publishableKey: process.env.STRIPE_KEY,
version: 'v3', // Default
}],
"nuxt-compress",
],
/*
** Axios module configuration
*/
axios: {
baseURL: process.env.SERVER_URL || 'http://0.0.0.0:5000/api',
credentials: false,
proxyHeaders: false
},
auth: {
strategies: {
google: {
client_id: process.env.GOOGLE_CLIENT_ID,
user: false,
redirect_uri: 'http://127.0.0.1:3000/'
},
facebook: {
client_id: process.env.FACEBOOK_CLIENT_ID,
userinfo_endpoint: false,
scope: ['public_profile', 'email'],
redirect_uri: 'https://tolocalhost.com/'
},
local: {
_scheme: '~/auth/local.js',
endpoints: {
login: {
url: 'auth/login',
method: 'post',
propertyName: false
},
user: {
url: 'user/show',
method: 'get',
propertyName: false
},
logout: false
}
}
},
redirect: {
login: '/auth/login',
logout: '/',
callback: '/',
home: '/'
},
plugins: ['~/plugins/auth.js']
},
router: {
middleware: ['auth'],
linkActiveClass: 'active-link'
},
webfontloader: {
google: {
families: ['IBM Plex Sans:300,400,700', 'Noto Sans JP:400,500', 'Sniglet:400,800'] //Loads Lato font with weights 400 and 700
}
},
'manifest': {
name: 'ノーブル 小説',
short_name: 'ノーブル',
lang: 'ja'
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {
},
splitChunks: {
layouts: true
},
styleResources: {
sass: ['./assets/css/abstracts/main.scss']
},
transpile: ['vue-clamp', 'resize-detector'],
postcss: {
plugins: [
require('postcss-gap-properties')(),
require('autoprefixer')({
grid: true,
flexbox: true,
stats: {
warnings: false
}
})
]
},
plugins: [new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})]
},
server: {
port: process.env.CLIENT_PORT || 4000, // default: 3000
host: process.env.API_HOST || '0.0.0.0', // default: localhost
},
}
I've searched everywhere online for the answer but none that seemed close to my current situation.
Oh I got it, it seems like there was a misspelling in importing of the component, and thus wasn't connected to the main nuxt network, meaning the component doesn't adhere to the hot reloading watched file.
Had the problem of hot reload not working.
Solved that by adding
watchers: {
webpack: {
aggregateTimeout: 300,
poll: 1000
}
}
in the nuxt.config.js file.

Has anyone successfully used customMapStyle?

I'm trying to add custom style to map
using customMapStyle but it is not working at all.
I've given it a json array as described in the documentation.
Anyone who has used it before, kindly help
Here the json array:
mapStyle = [
{
"elementType": "geometry",
"stylers": [
{
"color": "#f5f5f5"
}
]
},
{
"elementType": "labels.icon",
"stylers": [
{
"visibility": "off"
}
]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#f5f5f5"
}
]
},
{
"featureType": "administrative.land_parcel",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#bdbdbd"
}
]
},
{
"featureType": "poi",
"elementType": "geometry",
"stylers": [
{
"color": "#eeeeee"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry",
"stylers": [
{
"color": "#e5e5e5"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
},
{
"featureType": "road",
"elementType": "geometry",
"stylers": [
{
"color": "#ffffff"
}
]
},
{
"featureType": "road.arterial",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#757575"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"color": "#dadada"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#616161"
}
]
},
{
"featureType": "road.local",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
},
{
"featureType": "transit.line",
"elementType": "geometry",
"stylers": [
{
"color": "#e5e5e5"
}
]
},
{
"featureType": "transit.station",
"elementType": "geometry",
"stylers": [
{
"color": "#eeeeee"
}
]
},
{
"featureType": "water",
"elementType": "geometry",
"stylers": [
{
"color": "#c9c9c9"
}
]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9e9e9e"
}
]
}
]
I'm using this style in the object like:
customMapStyle={mapStyle}