Wordpress + Swup JS / Route plugin + path to regex - regex

My URL structure is as follows:
http://localhost:8888/cdw/work/foo-bar/
http://localhost:8888/cdw/work/bar-foo/
http://localhost:8888/cdw/work/etc-etc/
I'm using swup JS and the route plugin https://swup.js.org/plugins/route-name-plugin
None of the following are working. please help. I just need to match any URL that has "work"
Not working
new SwupRouteNamePlugin({
routes: [
{ name: 'work', path: '/work/(.*)'},
]
}),
Not working:
new SwupRouteNamePlugin({
routes: [
{ name: 'work', path: '/work/*'},
]
}),
Not working
new SwupRouteNamePlugin({
routes: [
{ name: 'work', path: '/work/:slug'},
]
}),
Not working:
new SwupRouteNamePlugin({
routes: [
{ name: 'work', path: '/work/'},
]
}),
What am i missing here? Please help!
Thanks!!!

for the url http://localhost:8888/cdw/work/foo-bar/
I needed to include /cdw/, not just /work/

Related

CSRF Token request position Django and Nuxt

lately i'm trying to implement a login api for a website.
I'm using Nuxt for the FE, Django REST Framework for the BE and Nuxt Auth Module for the JWT.
Now I tryed to use the normal option for implement my api:
https://auth.nuxtjs.org/schemes/local.html#options
auth: {
localStorage: false,
redirect: {
logout: '/login'
},
cookie: { options: { expires: 7} },//7 minuti
strategies: {
local: {
endpoints: {
login: { url: 'http://127.0.0.1:7777/api/users/login/', method: 'post', propertyName: false},
user: { url: 'http://127.0.0.1:7777/api/users/infoUser/', method: 'get', propertyName: false},
logout: { url: 'http://127.0.0.1:7777/api/users/logout/', method: 'post'},
},
tokenRequired: false,
tokenType: false
}
}
},
but in Django I don't see the token on vscode debug mode.
I need the token for retrieve the user infos.
Can someone help me?
Thank you.
I got it working with the standard Django Restframework endpoint: link
This returns the token which will be set automatically by NuxtJS. In <app>/urls.py I have:
urlpatterns = [
path('login', views.obtain_auth_token, name='login'),
path('user', Views.CurrentUser.as_view()),
path('logout', Views.Logout.as_view()),
]
With the user and logout endpoint being endpoints I created myself.
If this doesn't work can you spicify your way of working on the BE?

ERROR in multi (webpack)-dev-server/client?http://localhost:8080 ./src when use webpack4.2.0

when i use webpack4.2.0, play 'run start', show errors follow:
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
ERROR in multi (webpack)-dev-server/client?http://localhost:8001 ./src
Module not found: Error: Can't resolve './src' in '/Users/xudengwei/projects/xudengwei/myOpenGithub/angular5-scaffold'
# multi (webpack)-dev-server/client?http://localhost:8001 ./src
ℹ 「wdm」: Failed to compile.
#
my configure as follow:
webpack.common.js:
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
'polyfills': './src/polyfills.ts',
'vendor': './src/vendor.ts',
'app': './src/app/main.ts'
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader"
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
inject: true
})
]
};
webpack.dev.js:
var path = require('path');
var webpackMerge = require('webpack-merge');
var commonConfig = require('./webpack.common.js');
module.exports = webpackMerge(commonConfig, {
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
module: {
rules: []
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
inject: true
})
],
devServer: {
devServer: {
contentBase: './dist'
},
}
});
someone knows the reason?thanks
I also just get this error like you got and its was solved when i specify webpack config file. Try to add --config when you run webpack-dev-server. Ex. webpack-dev-server --config webpack.dev.js
what command did you run in the terminal? It looks to me like you used run start ./src and so it's complaining that it can't find the location ./scr
Try just running run start with no additional arguments. That did the trick for me

How to share common settings betwen 2 dojo application build profiles

We have 2 different builds of our dojo application, using either ourapp.profile.js or ourapp.custom.profile.js which contain the dojo application build profile.
Apart from a few differences in the layers property the rest of these 2 files are virtually identical. What's the best way to share the common settings between these 2 files?
Here's a simplified example of one our application profiles
var profile = (function () {
'use strict';
return {
basePath: "../",
releaseDir: "../../../build",
releaseName: "js",
action: "release",
dirs: ["../css", "../css/font", "../img", "../img/icons", "../stylus/themes/common"],
packages: [
{
name: "dbootstrap",
location: "dbootstrap"
},
{
name: "dgrid",
location: "dgrid"
},
{
name: "dstore",
location: "dstore"
},
{
name: "dijit",
location: "dijit"
},
{
name: "dojo",
location: "dojo"
},
{
name: "dojox",
location: "dojox"
},
{
name: "ourapp",
location: "ourapp"
},
{
name: "lib",
location: "lib"
},
{
name: "xstyle",
location: "xstyle"
},
{
name: "specs",
location: "specs"
}
],
layers: {
"dojo/dojo": {
include: [
"dojo/dojo",
"dojo/i18n",
"dojo/domReady",
"ourapp/boot",
// more includes
...
],
customBase: true,
boot: true,
},
// other layers
...
},
layerOptimize: "closure",
optimize: "closure",
cssOptimize: "comments",
mini: 1,
stripConsole: "warn",
selectorEngine: "lite",
insertAbsMids: false,
staticHasFeatures: {
"config-deferredInstrumentation": 0,
// More settings
..
},
defaultConfig: {
hasCache: {
"dojo-built": 1,
"dojo-loader": 1,
"dom": 1,
"host-browser": 1,
"config-selectorEngine": "lite"
},
async: 1
}
};
})();
Ideally we'd like both files to share one common set of settings and just specify the parts that differ in our 2 application profiles.
Update:
This page talks about multiple profile sources so I'm going to try splitting out the common parts to another profile file then when building running something like:
>build.bat --profile ourapp.shared.profile.js --profile ourapp.profile.js
or
>build.bat --profile ourapp.shared.profile.js --profile ourapp.custom.profile.js
Has anyone tried something similar?
The approach suggested in the Update to the question does work, but isn't very well documented about how different profile properties are combined or replaced so required some trial and error as certain properties are treated differently.
What we have now is the profile shown in the question (ourapp.profile.js), and ourapp.custom.profile.js as follows:
var profile = (function () {
'use strict';
return {
basePath: "../",
releaseName: "js-custom",
packages: [
{
name: "ourapp",
location: "ourapp-custom"
}}
]
};
})();
Now for our custom build we run this from the command line:
build.bat --profile ourapp.profile.js --profile ourapp.custom.profile.js
The properties in ourapp.custom.profile.js replace those in ourapp.profile.js changing the release name to 'js-custom' and replace the standard ourapp package with an alternative one in ourapp-custom.

require.js project optimization: can't find the dir value

Here is my project folder structure:
project
|--Gruntfile.js
|--build
|--public
|--|--js
|-----|--lib
|-----|--module
|-----|--main.js
my build config is in the Gruntfile.js
requirejs: {
compileProject: {
baseUrl: 'js',
appDir: 'public',
dir: 'build',
modules: [
{ name: 'main'}
],
paths: {
main: 'main',
jquery: 'lib/jquery-1.10.0.min.js'
}
}
}
but when I run it, the terminal tell me wrong:
Running "requirejs:compileProject" (requirejs) task
[Error: Error: Missing either an "out" or "dir" config value. If using "appDir" for a full project optimization, use "dir". If you want to optimize to one file, use "out".
however I have already set the dir value, so what's wrong with my code?
Your requirejs options should be specified within options:
requirejs: {
compileProject: {
options : {
baseUrl: 'js',
appDir: 'public',
dir: 'build',
modules: [
{ name: 'main'}
],
paths: {
main: 'main',
jquery: 'lib/jquery-1.10.0.min.js'
}
}
}
}

Using list in container or panel in sencha touch

I am learning sencha touch.
I am facing an issue while using xtype:'list', in a container. i.e it does not show anything to me . My code is:
{
xtype:'container',
items:[
{
xtype: 'list',
id: 'lists',
fields: [{name:'name'}],
store: {
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
},
itemTpl: '<div>{name}</div>'
}
],
}
Kindly point out where i am wrong ??
Any help would be great :)
Thanks in advance.
The issue is in your code. Try this -
Ext.create('Ext.List', {
fullscreen: true,
id:'lists',
itemTpl: '<div>{name}</div>',
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
});
OR
Ext.define('TestModel', {
extend: 'Ext.data.Model',
config: {
fields: ['name']
}
});
var store = Ext.create('Ext.data.Store', {
model: 'TestModel',
data: [
{name: 'Cowper'},
{name: 'Everett'},
{name: 'University'},
{name: 'Forest'}
]
});
Ext.create('Ext.List', {
fullscreen: true,
id:'lists',
itemTpl: '<div>{name}</div>',
store: store
});
I think it is solved when you add:
layout: 'fit'
to your container. This config sizes its child components.
ST2 Layout Guide
Note that list is actually a container. Try to minimize your nesting.
Take a look at the fullscreen config too.